mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixed #2989
This commit is contained in:
parent
8dce87cca0
commit
c975fe234e
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
* Fixed #2987
|
* Fixed #2987
|
||||||
|
* Fixed #2989
|
||||||
|
|
||||||
## Release Candidate 22 (18 Apr 2021)
|
## Release Candidate 22 (18 Apr 2021)
|
||||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#22
|
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#22
|
||||||
|
@ -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}
|
* 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.
|
* 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.
|
* This returns the {@link Logger} instance that Slimefun uses.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -149,8 +149,17 @@ public class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements
|
|||||||
SlimefunItem sfItem = BlockStorage.check(b);
|
SlimefunItem sfItem = BlockStorage.check(b);
|
||||||
|
|
||||||
if (sfItem != null && !sfItem.useVanillaBlockBreaking()) {
|
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));
|
drops.addAll(sfItem.getDrops(p));
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
BlockStorage.clearBlockInfo(b);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
b.breakNaturally(item);
|
b.breakNaturally(item);
|
||||||
|
Loading…
Reference in New Issue
Block a user