From 5ccc7e5b300d09b2dde5b827f377ceb4dac8d498 Mon Sep 17 00:00:00 2001 From: Flemmli97 Date: Sat, 26 Nov 2022 15:02:06 +0100 Subject: [PATCH] admin mode player can transfer claim owner close #197 --- .../java/io/github/flemmli97/flan/claim/ClaimStorage.java | 2 +- .../github/flemmli97/flan/event/EntityInteractEvents.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java b/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java index ecab647..3975493 100644 --- a/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java +++ b/common/src/main/java/io/github/flemmli97/flan/claim/ClaimStorage.java @@ -281,7 +281,7 @@ public class ClaimStorage implements IPermissionStorage { } public boolean transferOwner(Claim claim, ServerPlayer player, UUID newOwner) { - if (!player.getUUID().equals(claim.getOwner())) + if (!PlayerClaimData.get(player).isAdminIgnoreClaim() && !player.getUUID().equals(claim.getOwner())) return false; this.playerClaimMap.merge(claim.getOwner(), new HashSet<>(), (old, val) -> { old.remove(claim); diff --git a/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java b/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java index 0e48fc8..faf7365 100644 --- a/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java +++ b/common/src/main/java/io/github/flemmli97/flan/event/EntityInteractEvents.java @@ -66,7 +66,7 @@ public class EntityInteractEvents { public static InteractionResult useAtEntity(Player player, Level world, InteractionHand hand, Entity entity, /* Nullable */ EntityHitResult hitResult) { if (!(player instanceof ServerPlayer) || player.isSpectator() || canInteract(entity)) return InteractionResult.PASS; - if(entity instanceof Enemy) + if (entity instanceof Enemy) return InteractionResult.PASS; ClaimStorage storage = ClaimStorage.get((ServerLevel) world); BlockPos pos = entity.blockPosition(); @@ -76,7 +76,7 @@ public class EntityInteractEvents { if (!claim.canInteract((ServerPlayer) player, PermissionRegistry.ARMORSTAND, pos, true)) return InteractionResult.FAIL; } - if(entity instanceof Mob) + if (entity instanceof Mob) return claim.canInteract((ServerPlayer) player, PermissionRegistry.ANIMALINTERACT, pos, true) ? InteractionResult.PASS : InteractionResult.FAIL; } return InteractionResult.PASS; @@ -85,7 +85,7 @@ public class EntityInteractEvents { public static InteractionResult useEntity(Player p, Level world, InteractionHand hand, Entity entity) { if (!(p instanceof ServerPlayer player) || p.isSpectator() || canInteract(entity)) return InteractionResult.PASS; - if(entity instanceof Enemy) + if (entity instanceof Enemy) return InteractionResult.PASS; ClaimStorage storage = ClaimStorage.get((ServerLevel) world); BlockPos pos = entity.blockPosition();