Bug fixes for recent /transferclaim changes.
This commit is contained in:
parent
ed3347ab9b
commit
a29f18fe7a
|
|
@ -324,7 +324,12 @@ public abstract class DataStore
|
|||
}
|
||||
|
||||
//determine new owner
|
||||
PlayerData newOwnerData = this.getPlayerData(newOwnerID);
|
||||
PlayerData newOwnerData = null;
|
||||
|
||||
if(newOwnerID != null)
|
||||
{
|
||||
newOwnerData = this.getPlayerData(newOwnerID);
|
||||
}
|
||||
|
||||
//transfer
|
||||
claim.ownerID = newOwnerID;
|
||||
|
|
@ -336,8 +341,11 @@ public abstract class DataStore
|
|||
ownerData.getClaims().remove(claim);
|
||||
}
|
||||
|
||||
if(newOwnerData != null)
|
||||
{
|
||||
newOwnerData.getClaims().add(claim);
|
||||
}
|
||||
}
|
||||
|
||||
//adds a claim to the datastore, making it an effective claim
|
||||
synchronized void addClaim(Claim newClaim, boolean writeToStorage)
|
||||
|
|
|
|||
|
|
@ -976,32 +976,36 @@ public class GriefPrevention extends JavaPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer targetPlayer = null; //no argument = make an admin claim
|
||||
UUID newOwnerID = null; //no argument = make an admin claim
|
||||
String ownerName = "admin";
|
||||
|
||||
if(args.length > 0)
|
||||
{
|
||||
targetPlayer = this.resolvePlayerByName(args[0]);
|
||||
OfflinePlayer targetPlayer = this.resolvePlayerByName(args[0]);
|
||||
if(targetPlayer == null)
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
||||
return true;
|
||||
}
|
||||
newOwnerID = targetPlayer.getUniqueId();
|
||||
ownerName = targetPlayer.getName();
|
||||
}
|
||||
|
||||
//change ownerhsip
|
||||
try
|
||||
{
|
||||
this.dataStore.changeClaimOwner(claim, targetPlayer.getUniqueId());
|
||||
this.dataStore.changeClaimOwner(claim, newOwnerID);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferTopLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
//confirm
|
||||
GriefPrevention.sendMessage(player, TextMode.Success, Messages.TransferSuccess);
|
||||
GriefPrevention.AddLogEntry(player.getName() + " transferred a claim at " + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()) + " to " + targetPlayer.getName() + ".");
|
||||
GriefPrevention.AddLogEntry(player.getName() + " transferred a claim at " + GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()) + " to " + ownerName + ".");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user