diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvPTimerManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvPTimerManager.java index 48cc5620c..60cd9bb28 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvPTimerManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/pvptimer/PvPTimerManager.java @@ -3,6 +3,7 @@ package mineplex.game.clans.clans.pvptimer; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; +import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.Map; @@ -210,7 +211,7 @@ public class PvPTimerManager extends MiniPlugin } @SuppressWarnings("deprecation") - public boolean handleMining(Player player, Block block, boolean playSound) + public boolean handleMining(Player player, Block block, boolean playSound, ItemStack overrideDrop, boolean setToAir) { if (!hasTimer(player)) { @@ -231,9 +232,12 @@ public class PvPTimerManager extends MiniPlugin { block.getWorld().dropItemNaturally(block.getLocation().add(0.5, 0.3, 0.5), item); }; - Collection drops = block.getDrops(player.getItemInHand()); + Collection drops = overrideDrop != null ? Arrays.asList(overrideDrop) : block.getDrops(player.getItemInHand()); player.getInventory().addItem(converter.apply(drops)).forEach(dropper); - block.setType(Material.AIR); + if (setToAir) + { + block.setType(Material.AIR); + } return true; } @@ -330,7 +334,7 @@ public class PvPTimerManager extends MiniPlugin @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(BlockBreakEvent event) { - if (handleMining(event.getPlayer(), event.getBlock(), true)) + if (handleMining(event.getPlayer(), event.getBlock(), true, null, true)) { event.setCancelled(true); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java index c292c494b..ad84146fb 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/fields/FieldOreData.java @@ -118,7 +118,7 @@ public class FieldOreData return; } - if (!Managers.get(PvPTimerManager.class).handleMining(player, block, false)) + if (!Managers.get(PvPTimerManager.class).handleMining(player, block, false, stack, false)) { Vector vec = UtilAlg.getTrajectory(_loc.getBlock().getLocation().add(0.5, 0.5, 0.5), source).normalize();