Fix piston checks in subclaims (#1056)

This commit is contained in:
Frank van der Heijden 2020-10-11 21:21:43 -07:00 committed by GitHub
parent a34a0fecab
commit af25b289f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -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)

View File

@ -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