Added support for uuids in claimslist command
This commit is contained in:
parent
f34f0161ae
commit
6cd0d56e9b
|
|
@ -630,6 +630,10 @@ public abstract class DataStore
|
||||||
return playerData;
|
return playerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized public PlayerData getPlayerDataIfExists(UUID playerID) {
|
||||||
|
return this.playerNameToPlayerDataMap.get(playerID);
|
||||||
|
}
|
||||||
|
|
||||||
abstract PlayerData getPlayerDataFromStorage(UUID playerID);
|
abstract PlayerData getPlayerDataFromStorage(UUID playerID);
|
||||||
|
|
||||||
//deletes a claim or subdivision
|
//deletes a claim or subdivision
|
||||||
|
|
|
||||||
|
|
@ -2046,13 +2046,14 @@ public class GriefPrevention extends JavaPlugin
|
||||||
if (args.length > 1) return false;
|
if (args.length > 1) return false;
|
||||||
|
|
||||||
//player whose claims will be listed
|
//player whose claims will be listed
|
||||||
OfflinePlayer otherPlayer;
|
// OfflinePlayer otherPlayer;
|
||||||
|
UUID uuid;
|
||||||
|
|
||||||
//if another player isn't specified, assume current player
|
//if another player isn't specified, assume current player
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
if (player != null)
|
if (player != null)
|
||||||
otherPlayer = player;
|
uuid = player.getUniqueId();
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -2067,21 +2068,31 @@ public class GriefPrevention extends JavaPlugin
|
||||||
//otherwise try to find the specified player
|
//otherwise try to find the specified player
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
otherPlayer = this.resolvePlayerByName(args[0]);
|
OfflinePlayer otherPlayer = this.resolvePlayerByName(args[0]);
|
||||||
if (otherPlayer == null)
|
if (otherPlayer == null)
|
||||||
{
|
{
|
||||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
try {
|
||||||
return true;
|
uuid = UUID.fromString(args[0]);
|
||||||
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uuid = otherPlayer.getUniqueId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//load the target player's data
|
//load the target player's data
|
||||||
PlayerData playerData = this.dataStore.getPlayerData(otherPlayer.getUniqueId());
|
PlayerData playerData = this.dataStore.getPlayerDataIfExists(uuid);
|
||||||
|
if (playerData == null) {
|
||||||
|
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Vector<Claim> claims = playerData.getClaims();
|
Vector<Claim> claims = playerData.getClaims();
|
||||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.StartBlockMath,
|
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.StartBlockMath,
|
||||||
String.valueOf(playerData.getAccruedClaimBlocks()),
|
String.valueOf(playerData.getAccruedClaimBlocks()),
|
||||||
String.valueOf((playerData.getBonusClaimBlocks() + this.dataStore.getGroupBonusBlocks(otherPlayer.getUniqueId()))),
|
String.valueOf((playerData.getBonusClaimBlocks() + this.dataStore.getGroupBonusBlocks(uuid))),
|
||||||
String.valueOf((playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks() + this.dataStore.getGroupBonusBlocks(otherPlayer.getUniqueId()))));
|
String.valueOf((playerData.getAccruedClaimBlocks() + playerData.getBonusClaimBlocks() + this.dataStore.getGroupBonusBlocks(uuid))));
|
||||||
if (claims.size() > 0)
|
if (claims.size() > 0)
|
||||||
{
|
{
|
||||||
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.ClaimsListHeader);
|
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.ClaimsListHeader);
|
||||||
|
|
@ -2095,8 +2106,8 @@ public class GriefPrevention extends JavaPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
//drop the data we just loaded, if the player isn't online
|
//drop the data we just loaded, if the player isn't online
|
||||||
if (!otherPlayer.isOnline())
|
if (!Bukkit.getOfflinePlayer(uuid).isOnline())
|
||||||
this.dataStore.clearCachedPlayerData(otherPlayer.getUniqueId());
|
this.dataStore.clearCachedPlayerData(uuid);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user