diff --git a/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java b/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java index b1d3693..13d46b7 100644 --- a/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java +++ b/sponge/src/main/java/com/griefdefender/listener/CommonEntityEventHandler.java @@ -110,8 +110,10 @@ public boolean onEntityMove(MoveEntityEvent event, Location fromLocation, final Entity controller = EntityUtils.getControllingPassenger(targetEntity); if (controller != null && controller instanceof Player) { player = (Player) controller; + user = PermissionHolderCache.getInstance().getOrCreateUser(player); + } else { + user = PermissionHolderCache.getInstance().getOrCreateUser(targetEntity.getCreator().orElse(null)); } - user = PermissionHolderCache.getInstance().getOrCreateUser(targetEntity.getCreator().orElse(null)); } if (user != null) { @@ -168,7 +170,7 @@ public boolean onEntityMove(MoveEntityEvent event, Location fromLocation, fromClaim = this.storage.getClaimAt(fromLocation); } - if (player != null && GDFlags.ENTER_CLAIM && !enterBlacklisted && user.getInternalPlayerData().lastClaim != null) { + if (player != null && GDFlags.ENTER_CLAIM && !enterBlacklisted && user != null && user.getInternalPlayerData().lastClaim != null) { final GDClaim lastClaim = (GDClaim) user.getInternalPlayerData().lastClaim.get(); if (lastClaim != null && lastClaim != fromClaim) { if (GDPermissionManager.getInstance().getFinalPermission(event, toLocation, toClaim, GDPermissions.ENTER_CLAIM, targetEntity, targetEntity, player, TrustTypes.ACCESSOR, false) == Tristate.FALSE) {