mirror of
https://github.com/YouHaveTrouble/Enchantio.git
synced 2026-10-26 20:35:30 +00:00
make tunnelling more compatible with everything else
This commit is contained in:
@@ -74,10 +74,8 @@ public class TunnellingListener implements Listener {
|
|||||||
Set<Block> blocksToBreak = getSquare(block, blockFace, tunnellingEnchant.getBlocksPerLevel() * enchantLevel);
|
Set<Block> blocksToBreak = getSquare(block, blockFace, tunnellingEnchant.getBlocksPerLevel() * enchantLevel);
|
||||||
blockBreakSkips.addAll(blocksToBreak);
|
blockBreakSkips.addAll(blocksToBreak);
|
||||||
for (Block b : blocksToBreak) {
|
for (Block b : blocksToBreak) {
|
||||||
BlockBreakEvent breakEvent = new BlockBreakEvent(b, player);
|
event.getPlayer().breakBlock(b);
|
||||||
Enchantio.getPlugin(Enchantio.class).getServer().getPluginManager().callEvent(breakEvent);
|
|
||||||
blockBreakSkips.remove(b);
|
blockBreakSkips.remove(b);
|
||||||
breakBlock(breakEvent, tunnellingEnchant);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -126,15 +124,4 @@ public class TunnellingListener implements Listener {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void breakBlock(BlockBreakEvent event, TunnellingEnchant enchant) {
|
|
||||||
if (tunnelling == null) return;
|
|
||||||
if (event.isCancelled()) return;
|
|
||||||
Block block = event.getBlock();
|
|
||||||
ItemStack item = event.getPlayer().getInventory().getItemInMainHand();
|
|
||||||
int enchantLevel = item.getEnchantmentLevel(tunnelling);
|
|
||||||
if (enchantLevel <= 0) return;
|
|
||||||
block.breakNaturally(item, true, event.getExpToDrop() > 0, enchant.canBreakToolIncompatibleBlocks());
|
|
||||||
item.damage(1, event.getPlayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user