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 exceptions with inventories not being printed using the logger of the addon that caused it
|
||||||
* Fixed #2818
|
* Fixed #2818
|
||||||
* Fixed a duplication glitch with the Woodcutter Android
|
* Fixed a duplication glitch with the Woodcutter Android
|
||||||
|
* Fixed #2839
|
||||||
|
|
||||||
## Release Candidate 20 (30 Jan 2021)
|
## 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.Objects.SlimefunItem.SlimefunItem;
|
||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
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 class MiningAndroidListener implements Listener {
|
||||||
|
|
||||||
public MiningAndroidListener(@Nonnull SlimefunPlugin plugin) {
|
public MiningAndroidListener(@Nonnull SlimefunPlugin plugin) {
|
||||||
@ -19,14 +29,17 @@ public class MiningAndroidListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onAndroidMine(AndroidMineEvent e) {
|
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 (handler.isAndroidAllowed(e.getBlock())) {
|
if (slimefunItem != null) {
|
||||||
handler.onAndroidBreak(e);
|
slimefunItem.callItemHandler(BlockBreakHandler.class, handler -> {
|
||||||
} else {
|
if (handler.isAndroidAllowed(e.getBlock())) {
|
||||||
e.setCancelled(true);
|
handler.onAndroidBreak(e);
|
||||||
}
|
} else {
|
||||||
});
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user