mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2025-02-18 02:11:23 +01:00
Fix NPE in entity move handler.
This commit is contained in:
parent
1f1a1e655e
commit
3f8156836e
@ -110,9 +110,11 @@ public boolean onEntityMove(MoveEntityEvent event, Location<World> fromLocation,
|
|||||||
final Entity controller = EntityUtils.getControllingPassenger(targetEntity);
|
final Entity controller = EntityUtils.getControllingPassenger(targetEntity);
|
||||||
if (controller != null && controller instanceof Player) {
|
if (controller != null && controller instanceof Player) {
|
||||||
player = (Player) controller;
|
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) {
|
if (user != null) {
|
||||||
if (user.getInternalPlayerData().teleportDelay > 0) {
|
if (user.getInternalPlayerData().teleportDelay > 0) {
|
||||||
@ -168,7 +170,7 @@ public boolean onEntityMove(MoveEntityEvent event, Location<World> fromLocation,
|
|||||||
fromClaim = this.storage.getClaimAt(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();
|
final GDClaim lastClaim = (GDClaim) user.getInternalPlayerData().lastClaim.get();
|
||||||
if (lastClaim != null && lastClaim != fromClaim) {
|
if (lastClaim != null && lastClaim != fromClaim) {
|
||||||
if (GDPermissionManager.getInstance().getFinalPermission(event, toLocation, toClaim, GDPermissions.ENTER_CLAIM, targetEntity, targetEntity, player, TrustTypes.ACCESSOR, false) == Tristate.FALSE) {
|
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