mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #2839
This commit is contained in:
parent
af2b60cdf4
commit
c4be51f7bb
@ -44,6 +44,7 @@
|
||||
* Fixed exceptions with inventories not being printed using the logger of the addon that caused it
|
||||
* Fixed #2818
|
||||
* Fixed a duplication glitch with the Woodcutter Android
|
||||
* Fixed #2839
|
||||
|
||||
## Release Candidate 20 (30 Jan 2021)
|
||||
|
||||
|
@ -11,6 +11,16 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
|
||||
/**
|
||||
* This {@link Listener} makes sure that an {@link AndroidMineEvent} gets properly propagated
|
||||
* to the {@link BlockBreakHandler#onAndroidBreak(AndroidMineEvent)} method of a placed block.
|
||||
* If that block is a {@link SlimefunItem} of course.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see BlockBreakHandler
|
||||
*
|
||||
*/
|
||||
public class MiningAndroidListener implements Listener {
|
||||
|
||||
public MiningAndroidListener(@Nonnull SlimefunPlugin plugin) {
|
||||
@ -19,9 +29,11 @@ public class MiningAndroidListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onAndroidMine(AndroidMineEvent e) {
|
||||
SlimefunItem item = BlockStorage.check(e.getBlock());
|
||||
SlimefunItem slimefunItem = BlockStorage.check(e.getBlock());
|
||||
|
||||
item.callItemHandler(BlockBreakHandler.class, handler -> {
|
||||
// Fixes #2839 - Can't believe we forgot a null check here
|
||||
if (slimefunItem != null) {
|
||||
slimefunItem.callItemHandler(BlockBreakHandler.class, handler -> {
|
||||
if (handler.isAndroidAllowed(e.getBlock())) {
|
||||
handler.onAndroidBreak(e);
|
||||
} else {
|
||||
@ -30,3 +42,4 @@ public class MiningAndroidListener implements Listener {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user