diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java index 1c1e823de7..daf3329681 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/LumberAxe.java @@ -1,6 +1,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.tools; +import java.util.HashSet; import java.util.List; +import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; @@ -39,6 +41,7 @@ */ public class LumberAxe extends SlimefunItem implements NotPlaceable { + private static final Set IGNORE_EVENTS = new HashSet<>(); private static final int MAX_BROKEN = 100; private static final int MAX_STRIPPED = 20; @@ -52,6 +55,10 @@ public LumberAxe(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeT @Nonnull private ToolUseHandler onBlockBreak() { return (e, tool, fortune, drops) -> { + if (IGNORE_EVENTS.contains(e)) { + return; + } + if (!e.getPlayer().isSneaking() && Tag.LOGS.isTagged(e.getBlock().getType())) { List logs = Vein.find(e.getBlock(), MAX_BROKEN, b -> Tag.LOGS.isTagged(b.getType())); logs.remove(e.getBlock()); @@ -59,6 +66,7 @@ private ToolUseHandler onBlockBreak() { for (Block b : logs) { if (!BlockStorage.hasBlockInfo(b) && Slimefun.getProtectionManager().hasPermission(e.getPlayer(), b, Interaction.BREAK_BLOCK)) { BlockBreakEvent event = new BlockBreakEvent(b, e.getPlayer()); + IGNORE_EVENTS.add(event); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { breakLog(b, event.isDropItems());