diff --git a/CHANGELOG.md b/CHANGELOG.md index e3944d40b..d5a00ac72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ #### Fixes * Fixed #2987 +* Fixed #2989 ## Release Candidate 22 (18 Apr 2021) https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#22 diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java index c76cdaa4d..9f91dcdd0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunPlugin.java @@ -713,6 +713,17 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { } } + /** + * This returns the global instance of {@link SlimefunPlugin}. + * This may return null if the {@link Plugin} was disabled. + * + * @return The {@link SlimefunPlugin} instance + */ + @Nullable + public static SlimefunPlugin instance() { + return instance; + } + /** * This private static method allows us to throw a proper {@link Exception} * whenever someone tries to access a static method while the instance is null. @@ -726,17 +737,6 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon { } } - /** - * This returns the global instance of {@link SlimefunPlugin}. - * This may return null if the {@link Plugin} was disabled. - * - * @return The {@link SlimefunPlugin} instance - */ - @Nullable - public static SlimefunPlugin instance() { - return instance; - } - /** * This returns the {@link Logger} instance that Slimefun uses. *

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 ff06089f4..e3befeae2 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 @@ -149,8 +149,17 @@ public class ExplosiveTool extends SimpleSlimefunItem implements SlimefunItem sfItem = BlockStorage.check(b); if (sfItem != null && !sfItem.useVanillaBlockBreaking()) { - if (!sfItem.callItemHandler(BlockBreakHandler.class, handler -> handler.onPlayerBreak(e, item, drops))) { + /* + * Fixes #2989 + * We create a dummy here to pass onto the BlockBreakHandler. + * This will set the correct block context. + */ + BlockBreakEvent dummyEvent = new BlockBreakEvent(b, e.getPlayer()); + + if (!sfItem.callItemHandler(BlockBreakHandler.class, handler -> handler.onPlayerBreak(dummyEvent, item, drops)) && !dummyEvent.isCancelled()) { drops.addAll(sfItem.getDrops(p)); + b.setType(Material.AIR); + BlockStorage.clearBlockInfo(b); } } else { b.breakNaturally(item);