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
|
//determine new owner
|
||||||
PlayerData newOwnerData = this.getPlayerData(newOwnerID);
|
PlayerData newOwnerData = null;
|
||||||
|
|
||||||
|
if(newOwnerID != null)
|
||||||
|
{
|
||||||
|
newOwnerData = this.getPlayerData(newOwnerID);
|
||||||
|
}
|
||||||
|
|
||||||
//transfer
|
//transfer
|
||||||
claim.ownerID = newOwnerID;
|
claim.ownerID = newOwnerID;
|
||||||
|
|
@ -336,7 +341,10 @@ public abstract class DataStore
|
||||||
ownerData.getClaims().remove(claim);
|
ownerData.getClaims().remove(claim);
|
||||||
}
|
}
|
||||||
|
|
||||||
newOwnerData.getClaims().add(claim);
|
if(newOwnerData != null)
|
||||||
|
{
|
||||||
|
newOwnerData.getClaims().add(claim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//adds a claim to the datastore, making it an effective claim
|
//adds a claim to the datastore, making it an effective claim
|
||||||
|
|
|
||||||
|
|
@ -976,32 +976,36 @@ public class GriefPrevention extends JavaPlugin
|
||||||
return true;
|
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)
|
if(args.length > 0)
|
||||||
{
|
{
|
||||||
targetPlayer = this.resolvePlayerByName(args[0]);
|
OfflinePlayer targetPlayer = this.resolvePlayerByName(args[0]);
|
||||||
if(targetPlayer == null)
|
if(targetPlayer == null)
|
||||||
{
|
{
|
||||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
newOwnerID = targetPlayer.getUniqueId();
|
||||||
|
ownerName = targetPlayer.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
//change ownerhsip
|
//change ownerhsip
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.dataStore.changeClaimOwner(claim, targetPlayer.getUniqueId());
|
this.dataStore.changeClaimOwner(claim, newOwnerID);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferTopLevel);
|
e.printStackTrace();
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferTopLevel);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//confirm
|
//confirm
|
||||||
GriefPrevention.sendMessage(player, TextMode.Success, Messages.TransferSuccess);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user