mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 03:35:11 +01:00
Explicitly sets user for break blocks check.
The user was not being set. Also the ordering of event handling was random because both listeners had the same priority. Should fix: https://github.com/BentoBoxWorld/BentoBox/issues/534
This commit is contained in:
parent
28c89ff814
commit
1d5057ec5a
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user