From cb1fa363d6d366e01da812d719327a47647527d0 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 Date: Sun, 2 Jun 2024 17:36:54 +0200 Subject: [PATCH] also fix #4037 --- .../implementation/items/tools/ExplosiveTool.java | 5 +++++ .../slimefun4/implementation/listeners/BlockListener.java | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java index 6fe1174e4f..6d9dcaa14b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java @@ -160,6 +160,11 @@ private void breakBlock(BlockBreakEvent e, Player p, ItemStack item, Block b, Li SlimefunItem sfItem = BlockStorage.check(b); if (sfItem != null && !sfItem.useVanillaBlockBreaking()) { + // Fixes #4037 + if (Slimefun.getTickerTask().isDeletedSoon(b.getLocation())) { + return; + } + /* * Fixes #2989 * We create a dummy here to pass onto the BlockBreakHandler. diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java index 1549070714..4fcc9c070e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockListener.java @@ -196,6 +196,11 @@ private void callBlockHandler(BlockBreakEvent e, ItemStack item, List } if (sfItem != null && !sfItem.useVanillaBlockBreaking()) { + // Fixes #4037 + if (Slimefun.getTickerTask().isDeletedSoon(e.getBlock().getLocation()) || !BlockStorage.hasBlockInfo(e.getBlock())) { + return; + } + sfItem.callItemHandler(BlockBreakHandler.class, handler -> handler.onPlayerBreak(e, item, drops)); if (e.isCancelled()) { @@ -231,7 +236,7 @@ private void dropItems(BlockBreakEvent e, List drops) { // Disable normal block drops e.setDropItems(false); - // Fix #3182 - Drop the sensitive blocks that require supporting block but don't drop the supporting block + // Fixes #3182 - Drop the sensitive blocks that require supporting block but don't drop the supporting block e.getBlock().setType(Material.AIR, true); for (ItemStack drop : drops) {