Fix for HangingPlaceEvent error

https://github.com/BentoBoxWorld/Limits/issues/36
This commit is contained in:
tastybento 2019-08-09 14:09:35 -07:00
parent 03e51fc0f8
commit 078376f184
1 changed files with 1 additions and 2 deletions

View File

@ -119,9 +119,8 @@ public class EntityLimitListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlock(HangingPlaceEvent e) {
Player player = e.getPlayer();
boolean bypass = player.isOp() || player.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(e.getEntity().getWorld()) + "mod.bypass");
addon.getIslands().getIslandAt(e.getEntity().getLocation()).ifPresent(island -> {
boolean bypass = player.isOp() || player.hasPermission(addon.getPlugin().getIWM().getPermissionPrefix(e.getEntity().getWorld()) + "mod.bypass");
// Check if entity can be hung
if (!island.isSpawn() && atLimit(island, bypass, e.getEntity())) {
// Not allowed