mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-28 13:15:23 +01:00
Fix town children not transferring to new owner.
This commit is contained in:
parent
d65a8a5f86
commit
221399d93b
@ -1005,6 +1005,19 @@ public ClaimResult transferOwner(UUID newOwnerID, boolean checkEconomy, boolean
|
||||
|
||||
this.ownerPlayerData = newOwnerData;
|
||||
this.getClaimStorage().save();
|
||||
if (this.isTown()) {
|
||||
// update children
|
||||
for (Claim child : this.children) {
|
||||
if (child.getOwnerUniqueId().equals(ownerData.getUniqueId())) {
|
||||
((GDClaim) child).claimData.setOwnerUniqueId(newOwnerID);
|
||||
((GDClaim) child).ownerPlayerData = newOwnerData;
|
||||
if (ownerData.getInternalClaims().remove(child)) {
|
||||
newOwnerData.getInternalClaims().add(child);
|
||||
}
|
||||
((GDClaim) child).getClaimStorage().save();
|
||||
}
|
||||
}
|
||||
}
|
||||
return new GDClaimResult(this, ClaimResultType.SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -1022,6 +1022,19 @@ public ClaimResult transferOwner(UUID newOwnerID, boolean checkEconomy, boolean
|
||||
|
||||
this.ownerPlayerData = newOwnerData;
|
||||
this.getClaimStorage().save();
|
||||
if (this.isTown()) {
|
||||
// update children
|
||||
for (Claim child : this.children) {
|
||||
if (child.getOwnerUniqueId().equals(ownerData.getUniqueId())) {
|
||||
((GDClaim) child).claimData.setOwnerUniqueId(newOwnerID);
|
||||
((GDClaim) child).ownerPlayerData = newOwnerData;
|
||||
if (ownerData.getInternalClaims().remove(child)) {
|
||||
newOwnerData.getInternalClaims().add(child);
|
||||
}
|
||||
((GDClaim) child).getClaimStorage().save();
|
||||
}
|
||||
}
|
||||
}
|
||||
return new GDClaimResult(this, ClaimResultType.SUCCESS);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user