diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java index 86f988a0e..f88f995e9 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java @@ -264,12 +264,16 @@ public class BlockInteractionListener extends FlagListener { } /** - * Prevents blocks that are protected from being broken, which would bypass the protection + * When breaking blocks is allowed, this protects + * specific blocks from being broken, which would bypass the protection. + * For example, player enables break blocks, but chests are still protected + * Fires after the BreakBlocks check. * * @param e - event */ - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent e) { + setUser(User.getInstance(e.getPlayer())); checkClickedBlock(e, e.getBlock().getLocation(), e.getBlock().getType()); } } diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java index 30e6b11a0..3872e3f48 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BreakBlocksListener.java @@ -29,7 +29,7 @@ public class BreakBlocksListener extends FlagListener { */ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent e) { - checkIsland(e, e.getBlock().getLocation(), Flags.BREAK_BLOCKS); + setUser(User.getInstance(e.getPlayer())).checkIsland(e, e.getBlock().getLocation(), Flags.BREAK_BLOCKS); } /** @@ -74,7 +74,7 @@ public class BreakBlocksListener extends FlagListener { case CAKE: case DRAGON_EGG: case SPAWNER: - checkIsland(e, e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS); + setUser(User.getInstance(e.getPlayer())).checkIsland(e, e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS); break; default: break;