diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java b/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java index a9cdba7..78c45ef 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/BlockEventHandler.java @@ -534,7 +534,7 @@ public class BlockEventHandler implements Listener { Block invadedBlock = pistonBlock.getRelative(direction); Claim invadedClaim = this.dataStore.getClaimAt(invadedBlock.getLocation(), false, pistonClaim); - if (invadedClaim != null && (pistonClaim == null || !Objects.equals(pistonClaim.ownerID, invadedClaim.ownerID))) + if (invadedClaim != null && (pistonClaim == null || !Objects.equals(pistonClaim.getOwnerID(), invadedClaim.getOwnerID()))) { event.setCancelled(true); } @@ -619,7 +619,7 @@ public class BlockEventHandler implements Listener continue; // If owners are different, cancel. - if (pistonClaim == null || !Objects.equals(pistonClaim.ownerID, claim.ownerID)) + if (pistonClaim == null || !Objects.equals(pistonClaim.getOwnerID(), claim.getOwnerID())) { event.setCancelled(true); return; @@ -666,7 +666,7 @@ public class BlockEventHandler implements Listener lastClaim = claim; // If pushing this block will change ownership, cancel the event and take away the piston (for performance reasons). - if (pistonClaim == null || !Objects.equals(pistonClaim.ownerID, claim.ownerID)) + if (pistonClaim == null || !Objects.equals(pistonClaim.getOwnerID(), claim.getOwnerID())) { event.setCancelled(true); if (GriefPrevention.instance.config_pistonExplosionSound) diff --git a/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java b/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java index ad154ae..4cf9cf2 100644 --- a/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java +++ b/src/main/java/me/ryanhamshire/GriefPrevention/Claim.java @@ -711,6 +711,15 @@ public class Claim return GriefPrevention.lookupPlayerName(this.ownerID); } + public UUID getOwnerID() + { + if (this.parent != null) + { + return this.parent.ownerID; + } + return this.ownerID; + } + //whether or not a location is in a claim //ignoreHeight = true means location UNDER the claim will return TRUE //excludeSubdivisions = true means that locations inside subdivisions of the claim will return FALSE