当前位置: 首页>>代码示例>>Java>>正文


Java CSCoreLib类代码示例

本文整理汇总了Java中me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib的典型用法代码示例。如果您正苦于以下问题:Java CSCoreLib类的具体用法?Java CSCoreLib怎么用?Java CSCoreLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CSCoreLib类属于me.mrCookieSlime.CSCoreLibPlugin包,在下文中一共展示了CSCoreLib类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static void load(CSCoreLib plugin) {
	if (ReflectionUtils.getVersion().startsWith("v1_9_")) {
		plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin);
	}
	else if (ReflectionUtils.getVersion().startsWith("v1_10_")) {
		plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin);
	}
	else if (ReflectionUtils.getVersion().startsWith("v1_11_")) {
		plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin);
	}
	else if (ReflectionUtils.getVersion().startsWith("v1_12_")) {
		plugin.getServer().getPluginManager().registerEvents(new CustomBookOverlay1_9(), plugin);
	}

	plugin.getServer().getPluginManager().registerEvents(new Listener() {

		@EventHandler
		public void onDrop(PlayerDropItemEvent e) {
			if (opening.contains(e.getPlayer().getUniqueId())) e.setCancelled(true);
		}

	}, plugin);
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:24,代码来源:CustomBookOverlay.java

示例2: mine

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
private void mine(Block b, Block block) {
	Collection<ItemStack> drops = block.getDrops();
	if (!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), block)) {
		SlimefunItem item = BlockStorage.check(block);
		if(item != null) {
			if(fits(b, item.getItem())) {
				if(SlimefunItem.blockhandler.containsKey(item.getID())) {
					if (SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
						pushItems(b, BlockStorage.retrieve(block));
						if(SlimefunItem.blockhandler.containsKey(item.getID())) SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG);
						block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
						block.setType(Material.AIR);
					}
				}
			}
		}else {
			ItemStack[] items = drops.toArray(new ItemStack[drops.size()]);
			if (fits(b, items)) {
				pushItems(b, items);
				block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
				block.setType(Material.AIR);
			}
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:26,代码来源:ProgrammableAndroid.java

示例3: ChargingBench

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public ChargingBench(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack recipe[])
    {
        super(category, item, name, recipeType, recipe);
        new BlockMenuPreset(name, getInventoryTitle()) {

            final ChargingBench this$0;

            public void init()
            {
                constructMenu(this);
            }

            public void newInstance(BlockMenu blockmenu, Block block)
            {
            }

            public boolean canOpen(Block b, Player p)
            {
                return p.hasPermission("slimefun.inventory.bypass") || CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true);
            }

            public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow)
            {
                if(flow.equals(ItemTransportFlow.INSERT))
                    return getInputSlots();
                else
                    return getOutputSlots();
            }

            
            {
                this$0 = ChargingBench.this;
                super($anonymous0, $anonymous1);
            }
        }
;
    }
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:38,代码来源:ChargingBench.java

示例4: FluidPump

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public FluidPump(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack recipe[])
    {
        super(category, item, name, recipeType, recipe);
        new BlockMenuPreset(name, getInventoryTitle()) {

            final FluidPump this$0;

            public void init()
            {
                constructMenu(this);
            }

            public void newInstance(BlockMenu blockmenu, Block block)
            {
            }

            public boolean canOpen(Block b, Player p)
            {
                return p.hasPermission("slimefun.inventory.bypass") || CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true);
            }

            public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow)
            {
                if(flow.equals(ItemTransportFlow.INSERT))
                    return getInputSlots();
                else
                    return getOutputSlots();
            }

            
            {
                this$0 = FluidPump.this;
                super($anonymous0, $anonymous1);
            }
        }
;
    }
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:38,代码来源:FluidPump.java

示例5: mine

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
private void mine(Block b, Block block)
{
    Collection drops = block.getDrops();
    if(!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), block))
    {
        ItemStack items[] = (ItemStack[])drops.toArray(new ItemStack[drops.size()]);
        if(fits(b, items))
        {
            pushItems(b, items);
            block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
            block.setType(Material.AIR);
        }
    }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:15,代码来源:ProgrammableAndroid.java

示例6: movedig

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
private void movedig(Block b, BlockFace face, Block block)
{
    Collection drops = block.getDrops();
    if(!blockblacklist.contains(block.getType()) && !drops.isEmpty() && CSCoreLib.getLib().getProtectionManager().canBuild(UUID.fromString(BlockStorage.getBlockInfo(b, "owner")), block))
        try
        {
            ItemStack items[] = (ItemStack[])drops.toArray(new ItemStack[drops.size()]);
            if(fits(b, items))
            {
                pushItems(b, items);
                block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
                block.setType(Material.SKULL);
                block.setData((byte)1);
                Skull skull = (Skull)block.getState();
                skull.setRotation(face);
                skull.update(true, false);
                CustomSkull.setSkull(block, CustomSkull.getTexture(getItem()));
                b.setType(Material.AIR);
                BlockStorage.moveBlockInfo(b, block);
            }
        }
        catch(Exception x)
        {
            x.printStackTrace();
        }
    else
        try
        {
            move(b, face, block);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:36,代码来源:ProgrammableAndroid.java

示例7: randomize

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static int randomize(int max)
{
    if(max < 1)
        return 0;
    else
        return CSCoreLib.randomizer().nextInt(max);
}
 
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:8,代码来源:SlimefunStartup.java

示例8: onHarvest

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHarvest(BlockBreakEvent e) {
	if(e.getBlock().getType().equals(Material.SKULL)) dropFruitFromTree(e.getBlock());
	if (e.getBlock().getType().equals(Material.LEAVES) || e.getBlock().getType().equals(Material.LEAVES_2)) dropFruitFromTree(e.getBlock());
	if (e.getBlock().getType() == Material.LONG_GRASS) {
		if (CSCoreLib.randomizer().nextInt(100) < 6) e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), ExoticGarden.items.get(ExoticGarden.items.keySet().toArray(new String[ExoticGarden.items.keySet().size()])[CSCoreLib.randomizer().nextInt(ExoticGarden.items.keySet().size())]));
	}
	else {
		ItemStack item = ExoticGarden.harvestPlant(e.getBlock());
		if (item != null) {
			e.setCancelled(true);
			e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), item);
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:ExoticGarden,代码行数:16,代码来源:PlantsListener.java

示例9: spawn

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static void spawn(Location location, ItemStack itemstack, long ticks) {
	final Item item = location.getWorld().dropItem(location, itemstack);
	item.setPickupDelay(Integer.MAX_VALUE);
	Bukkit.getScheduler().scheduleSyncDelayedTask(CSCoreLib.getLib(), new Runnable() {
		
		@Override
		public void run() {
			if (item != null) item.remove();
		}
	}, ticks);
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:12,代码来源:FakeItem.java

示例10: createProfile

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
private static Object createProfile(String texture) throws Exception {
	if (!CSCoreLib.getLib().getCfg().contains("skulls.uuids." + texture)) {
		CSCoreLib.getLib().getCfg().setValue("skulls.uuids." + texture, UUID.randomUUID().toString());
		CSCoreLib.getLib().getCfg().save();
	}
	Object profile = profile_constructor.newInstance(UUID.fromString(CSCoreLib.getLib().getCfg().getString("skulls.uuids." + texture)), "CSCoreLib");
	Object properties = property.invoke(profile);
	insert_property.invoke(properties, "textures", property_constructor.newInstance("textures", texture));
	return profile;
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:11,代码来源:CustomSkull.java

示例11: open

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public void open(final Player p) {
	if (opening.contains(p.getUniqueId())) return;

	final int slot = p.getInventory().getHeldItemSlot();

	opening.add(p.getUniqueId());
	final ItemStack item = p.getInventory().getItem(slot);
	p.getInventory().setItem(slot, this.book);

	Bukkit.getScheduler().scheduleSyncDelayedTask(CSCoreLib.getLib(), new Runnable() {

		@Override
		public void run() {
			try {
				Object handle = ReflectionUtils.getHandle(CraftObject.PLAYER, p);
				Object copy = copyBook.invoke(null, book);

				if (ReflectionUtils.getVersion().startsWith("v1_8_")) {
					openBook.invoke(handle, copy);
				}
				else {
					openBook.invoke(handle, copy, const_mainhand);
				}
				p.getInventory().setItem(slot, item);
				PlayerInventory.update(p);
				opening.remove(p.getUniqueId());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}, 1L);
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:33,代码来源:CustomBookOverlay.java

示例12: launchFirework

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static void launchFirework(Location l, Color color) {
	Firework fw = (Firework)l.getWorld().spawnEntity(l, EntityType.FIREWORK);
	FireworkMeta meta = fw.getFireworkMeta();
    FireworkEffect effect = FireworkEffect.builder().flicker(CSCoreLib.randomizer().nextBoolean()).withColor(color).with(CSCoreLib.randomizer().nextInt(3) + 1 == 1 ? Type.BALL: Type.BALL_LARGE).trail(CSCoreLib.randomizer().nextBoolean()).build();
    meta.addEffect(effect);
    meta.setPower(CSCoreLib.randomizer().nextInt(2) + 1);
    fw.setFireworkMeta(meta);
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:9,代码来源:FireworkShow.java

示例13: createFirework

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static Firework createFirework(Location l, Color color) {
	Firework fw = (Firework)l.getWorld().spawnEntity(l, EntityType.FIREWORK);
	FireworkMeta meta = fw.getFireworkMeta();
    FireworkEffect effect = FireworkEffect.builder().flicker(CSCoreLib.randomizer().nextBoolean()).withColor(color).with(CSCoreLib.randomizer().nextInt(3) + 1 == 1 ? Type.BALL: Type.BALL_LARGE).trail(CSCoreLib.randomizer().nextBoolean()).build();
    meta.addEffect(effect);
    meta.setPower(CSCoreLib.randomizer().nextInt(2) + 1);
    fw.setFireworkMeta(meta);
    return fw;
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:10,代码来源:FireworkShow.java

示例14: launchRandom

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static void launchRandom(Player p, int amount) {
	for (int i = 0; i < amount; i++) {
		Location l = p.getLocation().clone();
		l.setX(l.getX() + CSCoreLib.randomizer().nextInt(amount));
		l.setX(l.getX() - CSCoreLib.randomizer().nextInt(amount));
		l.setZ(l.getZ() + CSCoreLib.randomizer().nextInt(amount));
		l.setZ(l.getZ() - CSCoreLib.randomizer().nextInt(amount));
		
           launchFirework(l, getColors()[CSCoreLib.randomizer().nextInt(getColors().length)]);
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:12,代码来源:FireworkShow.java

示例15: ProtectionManager

import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public ProtectionManager(CSCoreLib cscorelib) {
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("WorldGuard") && cscorelib.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
		registerNewModule("WorldGuard", new WorldGuardProtectionModule());
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("Factions")) {
		registerNewModule("Factions", new FactionsProtectionModule());
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("Towny")) {
		registerNewModule("Towny", new TownyProtectionModule());
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("GriefPrevention")) {
		registerNewModule("GriefPrevention", new GriefPreventionProtectionModule());
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("ASkyBlock")) {
		registerNewModule("ASkyBlock", new ASkyBlockProtectionModule());
	}
	if(cscorelib.getServer().getPluginManager().isPluginEnabled("LWC")){
		registerNewModule("LWC", new LWCProtectionModule());
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("PreciousStones")) {
		registerNewModule("PreciousStones", new PreciousStonesProtectionModule());
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("Lockette")) {
		registerNewModule("Lockette", new LocketteProtectionModule());
	}
	if(cscorelib.getServer().getPluginManager().isPluginEnabled("ProtectionStones")) {
           this.loadModuleMSG("ProtectionStones");
	}
	if (cscorelib.getServer().getPluginManager().isPluginEnabled("uSkyblock")) {
		this.loadModuleMSG("uSkyblock");
	}

}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:34,代码来源:ProtectionManager.java


注:本文中的me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。