mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-29 13:25:19 +01:00
Fix NPE in entity move handler.
This commit is contained in:
parent
1f1a1e655e
commit
3f8156836e
@ -110,8 +110,10 @@ public boolean onEntityMove(MoveEntityEvent event, Location<World> 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<World> 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user