本文整理汇总了Java中me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib类的典型用法代码示例。如果您正苦于以下问题:Java CSCoreLib类的具体用法?Java CSCoreLib怎么用?Java CSCoreLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSCoreLib类属于me.mrCookieSlime.CSCoreLibPlugin包,在下文中一共展示了CSCoreLib类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: fillChest
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static void fillChest(Block block) {
int min, max;
min = main.cfg.getInt("items.min");
max = main.cfg.getInt("items.max");
if (block.getState() instanceof Chest) {
Chest chest = (Chest) block.getState();
Inventory inv = chest.getBlockInventory();
for (int i = 0; i < CSCoreLib.randomizer().nextInt(max - min) + min; i++) {
inv.setItem(CSCoreLib.randomizer().nextInt(inv.getSize()), createItem(LootType.RANDOM));
}
}
}
开发者ID:TheBusyBiscuit,项目名称:MagicLoot3,代码行数:13,代码来源:ItemManager.java
示例17: onRuinGenerate
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
@EventHandler
public void onRuinGenerate(ChunkPopulateEvent e) {
if (!main.cfg.getStringList("world-blacklist").contains(e.getWorld().getName())) {
if (CSCoreLib.randomizer().nextInt(100) < main.cfg.getInt("chances.ruin")) {
int x, z, y;
x = e.getChunk().getX() * 16 + CSCoreLib.randomizer().nextInt(16);
z = e.getChunk().getZ() * 16 + CSCoreLib.randomizer().nextInt(16);
boolean flat = false;
for (y = e.getWorld().getMaxHeight(); y > 30; y--) {
Block current = e.getWorld().getBlockAt(x, y, z);
if (!current.getType().isSolid()) {
flat = true;
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
for (int k = 0; k < 8; k++) {
if ((current.getRelative(i, k, j).getType().isSolid() || current.getRelative(i, k, j).getType().toString().contains("LEAVES")) || !current.getRelative(i, -1, j).getType().isSolid()) flat = false;
}
}
}
if (flat) {
RuinBuilder.buildRuin(current.getLocation());
break;
}
}
}
}
}
}
开发者ID:TheBusyBiscuit,项目名称:MagicLoot3,代码行数:29,代码来源:MLListener.java
示例18: OilPump
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public OilPump(Category category, ItemStack item, String name, RecipeType recipeType, ItemStack recipe[])
{
super(category, item, name, recipeType, recipe);
new BlockMenuPreset(name, getInventoryTitle()) {
final OilPump this$0;
public void init()
{
constructMenu(this);
}
public void newInstance(BlockMenu blockmenu, Block block)
{
}
public boolean canOpen(Block b, Player p)
{
if(!p.hasPermission("slimefun.inventory.bypass") && !CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true))
return false;
if(!OreGenSystem.wasResourceGenerated(OreGenSystem.getResource("Oil"), b.getChunk()))
{
Messages.local.sendTranslation(p, "gps.geo.scan-required", true, new Variable[0]);
return false;
} else
{
return true;
}
}
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow)
{
if(flow.equals(ItemTransportFlow.INSERT))
return getInputSlots();
else
return getOutputSlots();
}
{
this$0 = OilPump.this;
super($anonymous0, $anonymous1);
}
}
;
}
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:47,代码来源:OilPump.java
示例19: chance
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
public static boolean chance(int max, int percentage)
{
if(max < 1)
return false;
return CSCoreLib.randomizer().nextInt(max) <= percentage;
}
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:7,代码来源:SlimefunStartup.java
示例20: onDeath
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; //导入依赖的package包/类
@EventHandler(priority=EventPriority.HIGHEST)
public void onDeath(final EntityDeathEvent e) {
if (e.getEntity().hasMetadata("android_killer")) {
for (MetadataValue value: e.getEntity().getMetadata("android_killer")) {
final AndroidObject obj = (AndroidObject) value.value();
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance, new Runnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
List<ItemStack> items = new ArrayList<ItemStack>();
for (Entity n: e.getEntity().getNearbyEntities(0.5D, 0.5D, 0.5D)) {
if (n instanceof Item && !n.hasMetadata("no_pickup")) {
items.add(((Item) n).getItemStack());
n.remove();
}
}
switch (e.getEntityType()) {
case BLAZE: {
items.add(new ItemStack(Material.BLAZE_ROD, 1 + CSCoreLib.randomizer().nextInt(2)));
break;
}
case PIG_ZOMBIE: {
items.add(new ItemStack(Material.GOLD_NUGGET, 1 + CSCoreLib.randomizer().nextInt(3)));
break;
}
case SKELETON: {
if (((Skeleton) e.getEntity()).getSkeletonType().equals(SkeletonType.WITHER)) {
if (CSCoreLib.randomizer().nextInt(250) < 2) items.add(new MaterialData(Material.SKULL_ITEM, (byte) 1).toItemStack(1));
}
break;
}
default:
break;
}
obj.getAndroid().addItems(obj.getBlock(), items.toArray(new ItemStack[items.size()]));
ExperienceOrb exp = (ExperienceOrb) e.getEntity().getWorld().spawnEntity(e.getEntity().getLocation(), EntityType.EXPERIENCE_ORB);
exp.setExperience(1 + CSCoreLib.randomizer().nextInt(6));
}
}, 1L);
return;
}
}
}
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:47,代码来源:AndroidKillingListener.java
注:本文中的me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论