diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java index 0813441f2..642f20998 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java @@ -843,4 +843,398 @@ public class UtilBlock return blocks; } + + public static ItemStack blockToInventoryItemStack(Block block) + { + ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData()); + + switch (block.getType()) + { + case SAPLING: + itemStack.setDurability((short) 0); + break; + case WATER: + itemStack.setType(Material.WATER_BUCKET); + itemStack.setDurability((short) 0); + break; + case STATIONARY_WATER: + itemStack.setType(Material.WATER_BUCKET); + itemStack.setDurability((short) 0); + break; + case LAVA: + itemStack.setType(Material.LAVA_BUCKET); + itemStack.setDurability((short) 0); + break; + case STATIONARY_LAVA: + itemStack.setType(Material.LAVA_BUCKET); + itemStack.setDurability((short) 0); + break; + case LOG: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case LEAVES: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case DISPENSER: + itemStack.setDurability((short) 0); + break; + case BED_BLOCK: + itemStack.setType(Material.BED); + itemStack.setDurability((short) 0); + break; + case POWERED_RAIL: + itemStack.setDurability((short) 0); + break; + case DETECTOR_RAIL: + itemStack.setDurability((short) 0); + break; + case PISTON_STICKY_BASE: + itemStack.setDurability((short) 0); + break; + case PISTON_BASE: + itemStack.setDurability((short) 0); + break; + case PISTON_EXTENSION: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case PISTON_MOVING_PIECE: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case DOUBLE_STEP: + itemStack.setType(Material.STEP); + itemStack.setAmount(2); + break; + case STEP: + itemStack.setDurability((short) (itemStack.getDurability() % 8)); + break; + case TORCH: + itemStack.setDurability((short) 0); + break; + case FIRE: + itemStack.setType(Material.FIREBALL); + itemStack.setDurability((short) 0); + break; + case WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case CHEST: + itemStack.setDurability((short) 0); + break; + case REDSTONE_WIRE: + itemStack.setType(Material.REDSTONE); + itemStack.setDurability((short) 0); + break; + case CROPS: + itemStack.setType(Material.SEEDS); + itemStack.setDurability((short) 0); + break; + case SOIL: + itemStack.setType(Material.DIRT); + itemStack.setDurability((short) 0); + break; + case FURNACE: + itemStack.setDurability((short) 0); + break; + case BURNING_FURNACE: + itemStack.setType(Material.FURNACE); + itemStack.setDurability((short) 0); + break; + case SIGN_POST: + itemStack.setType(Material.SIGN); + itemStack.setDurability((short) 0); + break; + case WOODEN_DOOR: + itemStack.setType(Material.WOOD_DOOR); + itemStack.setDurability((short) 0); + break; + case LADDER: + itemStack.setDurability((short) 0); + break; + case RAILS: + itemStack.setDurability((short) 0); + break; + case COBBLESTONE_STAIRS: + itemStack.setDurability((short) 0); + break; + case WALL_SIGN: + itemStack.setType(Material.SIGN); + itemStack.setDurability((short) 0); + break; + case LEVER: + itemStack.setDurability((short) 0); + break; + case STONE_PLATE: + itemStack.setDurability((short) 0); + break; + case IRON_DOOR_BLOCK: + itemStack.setType(Material.IRON_DOOR); + itemStack.setDurability((short) 0); + break; + case WOOD_PLATE: + itemStack.setDurability((short) 0); + break; + case GLOWING_REDSTONE_ORE: + itemStack.setType(Material.REDSTONE_ORE); + break; + case REDSTONE_TORCH_OFF: + itemStack.setType(Material.REDSTONE_TORCH_ON); + itemStack.setDurability((short) 0); + break; + case REDSTONE_TORCH_ON: + itemStack.setDurability((short) 0); + break; + case STONE_BUTTON: + itemStack.setDurability((short) 0); + break; + case SNOW: + itemStack.setAmount(1 + itemStack.getDurability()); + itemStack.setDurability((short) 0); + break; + case CACTUS: + itemStack.setDurability((short) 0); + break; + case SUGAR_CANE_BLOCK: + itemStack.setType(Material.SUGAR_CANE); + itemStack.setDurability((short) 0); + break; + case JUKEBOX: + itemStack.setDurability((short) 0); + break; + case PORTAL: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case CAKE_BLOCK: + itemStack.setType(Material.CAKE); + itemStack.setDurability((short) 0); + break; + case DIODE_BLOCK_OFF: + itemStack.setType(Material.DIODE); + itemStack.setDurability((short) 0); + break; + case DIODE_BLOCK_ON: + itemStack.setType(Material.DIODE); + itemStack.setDurability((short) 0); + break; + case TRAP_DOOR: + itemStack.setDurability((short) 0); + break; + case HUGE_MUSHROOM_1: + itemStack.setDurability((short) 0); + break; + case HUGE_MUSHROOM_2: + itemStack.setDurability((short) 0); + break; + case PUMPKIN_STEM: + itemStack.setType(Material.PUMPKIN_SEEDS); + itemStack.setDurability((short) 0); + break; + case MELON_STEM: + itemStack.setType(Material.MELON_SEEDS); + itemStack.setDurability((short) 0); + break; + case VINE: + itemStack.setDurability((short) 0); + break; + case FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case BRICK_STAIRS: + itemStack.setDurability((short) 0); + break; + case SMOOTH_STAIRS: + itemStack.setDurability((short) 0); + break; + case NETHER_BRICK_STAIRS: + itemStack.setDurability((short) 0); + break; + case NETHER_WARTS: + itemStack.setType(Material.NETHER_STALK); + itemStack.setDurability((short) 0); + break; + case BREWING_STAND: + itemStack.setType(Material.BREWING_STAND_ITEM); + itemStack.setDurability((short) 0); + break; + case CAULDRON: + itemStack.setType(Material.CAULDRON_ITEM); + itemStack.setDurability((short) 0); + break; + case ENDER_PORTAL: + itemStack.setType(Material.AIR); + itemStack.setDurability((short) 0); + break; + case ENDER_PORTAL_FRAME: + itemStack.setDurability((short) 0); + break; + case REDSTONE_LAMP_ON: + itemStack.setType(Material.REDSTONE_LAMP_OFF); + break; + case WOOD_DOUBLE_STEP: + itemStack.setType(Material.WOOD_STEP); + itemStack.setAmount(2); + break; + case WOOD_STEP: + itemStack.setDurability((short) (itemStack.getDurability() % 8)); + break; + case COCOA: + itemStack.setType(Material.INK_SACK); + itemStack.setDurability((short) 3); + break; + case SANDSTONE_STAIRS: + itemStack.setDurability((short) 0); + break; + case ENDER_CHEST: + itemStack.setDurability((short) 0); + break; + case TRIPWIRE_HOOK: + itemStack.setDurability((short) 0); + break; + case TRIPWIRE: + itemStack.setType(Material.STRING); + itemStack.setDurability((short) 0); + break; + case SPRUCE_WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case BIRCH_WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case JUNGLE_WOOD_STAIRS: + itemStack.setDurability((short) 0); + break; + case COMMAND: + itemStack.setDurability((short) 0); + break; + case FLOWER_POT: + itemStack.setType(Material.FLOWER_POT_ITEM); + itemStack.setDurability((short) 0); + break; + case CARROT: + itemStack.setType(Material.CARROT_ITEM); + itemStack.setDurability((short) 0); + break; + case POTATO: + itemStack.setType(Material.POTATO_ITEM); + itemStack.setDurability((short) 0); + break; + case WOOD_BUTTON: + itemStack.setDurability((short) 0); + break; + case SKULL: + itemStack.setType(Material.SKULL_ITEM); + break; + case TRAPPED_CHEST: + itemStack.setDurability((short) 0); + break; + case GOLD_PLATE: + itemStack.setDurability((short) 0); + break; + case IRON_PLATE: + itemStack.setDurability((short) 0); + break; + case REDSTONE_COMPARATOR_OFF: + itemStack.setType(Material.REDSTONE_COMPARATOR); + itemStack.setDurability((short) 0); + break; + case REDSTONE_COMPARATOR_ON: + itemStack.setType(Material.REDSTONE_COMPARATOR); + itemStack.setDurability((short) 0); + break; + case DAYLIGHT_DETECTOR: + itemStack.setDurability((short) 0); + break; + case HOPPER: + itemStack.setDurability((short) 0); + break; + case QUARTZ_STAIRS: + itemStack.setDurability((short) 0); + break; + case ACTIVATOR_RAIL: + itemStack.setDurability((short) 0); + break; + case DROPPER: + itemStack.setDurability((short) 0); + break; + case LEAVES_2: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case LOG_2: + itemStack.setDurability((short) (itemStack.getDurability() % 4)); + break; + case ACACIA_STAIRS: + itemStack.setDurability((short) 0); + break; + case DARK_OAK_STAIRS: + itemStack.setDurability((short) 0); + break; + case IRON_TRAPDOOR: + itemStack.setDurability((short) 0); + break; + case HAY_BLOCK: + itemStack.setDurability((short) 0); + break; + case STANDING_BANNER: + itemStack.setType(Material.BANNER); + itemStack.setDurability((short) 0); + break; + case WALL_BANNER: + itemStack.setType(Material.BANNER); + itemStack.setDurability((short) 0); + break; + case DAYLIGHT_DETECTOR_INVERTED: + itemStack.setType(Material.DAYLIGHT_DETECTOR); + itemStack.setDurability((short) 0); + break; + case RED_SANDSTONE_STAIRS: + itemStack.setDurability((short) 0); + break; + case DOUBLE_STONE_SLAB2: + itemStack.setType(Material.STONE_SLAB2); + itemStack.setAmount(2); + break; + case STONE_SLAB2: + itemStack.setDurability((short) (itemStack.getDurability() % 8)); + break; + case SPRUCE_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case BIRCH_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case JUNGLE_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case DARK_OAK_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case ACACIA_FENCE_GATE: + itemStack.setDurability((short) 0); + break; + case SPRUCE_DOOR: + itemStack.setType(Material.SPRUCE_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case BIRCH_DOOR: + itemStack.setType(Material.BIRCH_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case JUNGLE_DOOR: + itemStack.setType(Material.JUNGLE_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case ACACIA_DOOR: + itemStack.setType(Material.ACACIA_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + case DARK_OAK_DOOR: + itemStack.setType(Material.DARK_OAK_DOOR_ITEM); + itemStack.setDurability((short) 0); + break; + } + + return itemStack; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java index 80a89bb76..114fbeeff 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemFirework.java @@ -30,7 +30,7 @@ public class ItemFirework extends ItemGadget }, -1, Material.FIREWORK, (byte)0, - 250, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50)); + 500, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50)); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java index ea3a786ba..0692aa661 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemMelonLauncher.java @@ -140,7 +140,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown { Item melon = melonIterator.next(); - if (melon.isDead() || !melon.isValid() || melon.getTicksLived() > 400) + if (melon.isDead() || !melon.isValid() || melon.getTicksLived() > 100) { melonIterator.remove(); melon.remove(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java index 787557d7a..0bf3531b7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ItemTNT.java @@ -70,7 +70,7 @@ public class ItemTNT extends ItemGadget double mult = players.get(player); //Knockback - UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 2 * mult, false, 0, 0.5 + 1 * mult, 10, true); + UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 1 * mult, false, 0, 0.5 + 0.5 * mult, 10, true); } // Simulating explosion to prevent water from being evaporated. diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java index 3b0bfe79d..22cf5855e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBat.java @@ -85,7 +85,7 @@ public class MorphBat extends MorphGadget implements IThrown if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 100, false, false)) + if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics")) return; //Effect @@ -106,7 +106,7 @@ public class MorphBat extends MorphGadget implements IThrown if (!IsActive(player)) return; - if (!Recharge.Instance.use(player, "Poop", 4000, true, false)) + if (!Recharge.Instance.use(player, "Poop", 4000, true, false, "Cosmetics")) return; //Action diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java index 2ebb73f20..6e3be5fce 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphChicken.java @@ -76,7 +76,7 @@ public class MorphChicken extends MorphGadget if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 100, false, false)) + if (!Recharge.Instance.use(player, GetName(), 100, false, false, "Cosmetics")) return; Vector offset = player.getLocation().getDirection(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java index 07d1ae671..96dcda738 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCow.java @@ -57,7 +57,7 @@ public class MorphCow extends MorphGadget if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 2500, false, false)) + if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.COW_IDLE, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java index 5cbc89f29..8c9419476 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphCreeper.java @@ -119,7 +119,7 @@ public class MorphCreeper extends MorphGadget double mult = players.get(other); //Knockback - UtilAction.velocity(other, UtilAlg.getTrajectory(player.getLocation(), other.getLocation()), 1 + 1.5 * mult, false, 0, 0.5 + 1 * mult, 3, true); + UtilAction.velocity(other, UtilAlg.getTrajectory(player.getLocation(), other.getLocation()), 1 + 1 * mult, false, 0, 0.6 + 0.6 * mult, 3, true); } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java index d336a2dbb..72c6518d6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphEnderman.java @@ -78,7 +78,7 @@ public class MorphEnderman extends MorphGadget player.setAllowFlight(false); //Set Recharge - Recharge.Instance.use(player, GetName(), 2000, false, false); + Recharge.Instance.use(player, GetName(), 2000, false, false, "Cosmetics"); //Smoke Trail Block lastSmoke = player.getLocation().getBlock(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java index 44662f5a1..d42b43023 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphPig.java @@ -73,7 +73,7 @@ public class MorphPig extends MorphGadget if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 400, false, false)) + if (!Recharge.Instance.use(player, GetName(), 400, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5)); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java index 12f9a3eca..4737cf7ad 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphSlime.java @@ -83,7 +83,7 @@ public class MorphSlime extends MorphGadget if (!UtilEnt.isGrounded(player)) return; - if (!Recharge.Instance.use(player, GetName(), 1000, false, false)) + if (!Recharge.Instance.use(player, GetName(), 1000, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.SLIME_ATTACK, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java index bd9ad5229..ed61f6511 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphTitan.java @@ -94,7 +94,7 @@ public class MorphTitan extends MorphGadget if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, "Guardians Laser", 4000, true, false)) + if (!Recharge.Instance.use(player, "Guardians Laser", 6000, true, false, "Cosmetics")) return; DisguiseBase base = Manager.getDisguiseManager().getDisguise(player); @@ -148,7 +148,7 @@ public class MorphTitan extends MorphGadget double mult = players.get(ent); //Knockback - UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 3 * mult, false, 0, 1 + 2 * mult, 10, true); + UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true); } //Sound diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java index e0a864177..985247b53 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphVillager.java @@ -87,7 +87,7 @@ public class MorphVillager extends MorphGadget implements IThrown return; } - if (!Recharge.Instance.use(player, GetName(), 800, false, false)) + if (!Recharge.Instance.use(player, GetName(), 800, false, false, "Cosmetics")) return; player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java index 602868005..506ffc717 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphWither.java @@ -96,7 +96,7 @@ public class MorphWither extends MorphGadget if (!UtilEvent.isAction(event, ActionType.L)) return; - if (!Recharge.Instance.use(player, GetName(), 1600, false, false)) + if (!Recharge.Instance.use(player, GetName(), 2500, false, false, "Cosmetics")) return; Vector offset = player.getLocation().getDirection(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 441f04535..232abb0eb 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -153,7 +153,7 @@ public abstract class ItemGadget extends Gadget } //Recharge - if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false)) + if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics")) { UtilInv.Update(player); return; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java index 3a4c0b1b0..34c2a8c1f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/recharge/Recharge.java @@ -29,6 +29,9 @@ public class Recharge extends MiniPlugin public HashSet informSet = new HashSet(); public NautHashMap> _recharge = new NautHashMap>(); + //Used to increase cooldown when gadgets are being spammed + public NautHashMap> _gadgetSlow = new NautHashMap>(); + protected Recharge(JavaPlugin plugin) { super("Recharge", plugin); @@ -76,10 +79,22 @@ public class Recharge extends MiniPlugin @EventHandler public void update(UpdateEvent event) { - if (event.getType() != UpdateType.TICK) - return; + if (event.getType() == UpdateType.TICK) + recharge(); - recharge(); + if (event.getType() == UpdateType.SLOW) + for (ArrayList times : _gadgetSlow.values()) + { + Iterator timeIter = times.iterator(); + + while (timeIter.hasNext()) + { + long time = timeIter.next(); + + if (UtilTime.elapsed(time, 20000)) + timeIter.remove(); + } + } } public void recharge() @@ -112,24 +127,40 @@ public class Recharge extends MiniPlugin public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem) { - return use(player, ability, ability, recharge, inform, attachItem); + return use(player, ability, ability, recharge, inform, attachItem, false, true, null); + } + + public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem, String cooldownPool) + { + return use(player, ability, ability, recharge, inform, attachItem, false, true, cooldownPool); } public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform, boolean attachItem) { - return use(player, ability, abilityFull, recharge, inform, attachItem, false, true); + return use(player, ability, abilityFull, recharge, inform, attachItem, false, true, null); } public boolean use(Player player, String ability, long recharge, boolean inform, boolean attachItem, boolean attachDurability) { - return use(player, ability, ability, recharge, inform, attachItem, attachDurability, true); + return use(player, ability, ability, recharge, inform, attachItem, attachDurability, true, null); } public boolean use(Player player, String ability, String abilityFull, long recharge, boolean inform, - boolean attachItem, boolean attachDurability, boolean clearOnDeath) + boolean attachItem, boolean attachDurability, boolean clearOnDeath, String cooldownPool) { if (recharge == 0) return true; + + //Cooldown Pool + if (cooldownPool != null) + { + if (!_gadgetSlow.containsKey(cooldownPool)) + _gadgetSlow.put(cooldownPool, new ArrayList()); + + int count = _gadgetSlow.get(cooldownPool).size(); + + recharge += count * 40; + } //Ensure Expirey recharge(); @@ -149,6 +180,10 @@ public class Recharge extends MiniPlugin return false; } + + //Add Slow + if (cooldownPool != null) + _gadgetSlow.get(cooldownPool).add(System.currentTimeMillis()); //Insert UseRecharge(player, ability, recharge, attachItem, attachDurability, clearOnDeath); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 50865ed1a..f0533de91 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -66,6 +66,7 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; import org.bukkit.util.Vector; public class GameFlagManager implements Listener @@ -676,6 +677,11 @@ public class GameFlagManager implements Listener final Player player = event.getEntity(); + //Remove all conditions + Manager.GetCondition().EndCondition(player, null, null); + for (PotionEffect potion : player.getActivePotionEffects()) + player.removePotionEffect(potion.getType()); + //Visual Manager.GetCondition().Factory().Blind("Ghost", player, player, 2.5, 0, false, false, false);