1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2021-04-25 19:29:57 +02:00
parent 8dce87cca0
commit c975fe234e
3 changed files with 22 additions and 12 deletions

View File

@ -39,6 +39,7 @@
#### Fixes
* Fixed #2987
* Fixed #2989
## Release Candidate 22 (18 Apr 2021)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#22

View File

@ -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.
* <p>

View File

@ -149,8 +149,17 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> 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);