diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java index 33e26bbb0..a2f7643dd 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/rares/RunedPickaxe.java @@ -9,6 +9,8 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; @@ -46,7 +48,8 @@ public class RunedPickaxe extends RareItem return; } - UtilServer.getPlayersCollection().forEach(player -> { + UtilServer.getPlayersCollection().forEach(player -> + { PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player); if (!(gear.getWeapon() instanceof RunedPickaxe)) @@ -61,8 +64,7 @@ public class RunedPickaxe extends RareItem UtilTextBottom.displayProgress("Instant mine", (((double) (((double) System.currentTimeMillis()) - ((double) pick._instamineEnabled))) / 12000D), null, true, player); } - if (pick._enabled - && (System.currentTimeMillis() - pick._instamineEnabled) >= 12000) + if (pick._enabled && (System.currentTimeMillis() - pick._instamineEnabled) >= 12000) { Recharge.Instance.use(player, "Instant Mine", 15 * 1000, true, true); @@ -76,6 +78,19 @@ public class RunedPickaxe extends RareItem }); } + @EventHandler + public void onSwap(PlayerItemHeldEvent event) + { + if (event.getPlayer().hasPotionEffect(PotionEffectType.FAST_DIGGING)) + { + ItemStack previous = event.getPlayer().getInventory().getItem(event.getPreviousSlot()); + if (previous != null && previous.getType() == Material.RECORD_7) + { + event.getPlayer().removePotionEffect(PotionEffectType.FAST_DIGGING); + } + } + } + @EventHandler(priority = EventPriority.LOWEST) public void blockDamage(BlockDamageEvent event) { @@ -149,7 +164,8 @@ public class RunedPickaxe extends RareItem public RunedPickaxe() { - super("Runed Pickaxe", UtilText.splitLinesToArray(new String[] { + super("Runed Pickaxe", UtilText.splitLinesToArray(new String[] + { "What an interesting design this pickaxe seems to have!", C.cYellow + "Right-Click" + C.cWhite + " to use " + F.elem("Instant mine") + "." }, LineFormat.LORE), Material.RECORD_7);