From af5fade803059a734b372505be737c9fe5d4ea46 Mon Sep 17 00:00:00 2001 From: bloodshot Date: Sun, 28 Jul 2019 10:27:25 -0400 Subject: [PATCH] Fix /claiminfo displaying public and wilderness owner incorrectly. --- .../com/griefdefender/command/CommandClaimInfo.java | 10 +++++----- .../main/java/com/griefdefender/util/PlayerUtil.java | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/griefdefender/command/CommandClaimInfo.java b/bukkit/src/main/java/com/griefdefender/command/CommandClaimInfo.java index 8088a07..fea3541 100644 --- a/bukkit/src/main/java/com/griefdefender/command/CommandClaimInfo.java +++ b/bukkit/src/main/java/com/griefdefender/command/CommandClaimInfo.java @@ -262,25 +262,25 @@ public void execute(CommandSender src, String[] args) { for (UUID uuid : accessorList) { final String userName = PlayerUtil.getInstance().getUserName(uuid); if (userName != null) { - accessors += PlayerUtil.getInstance().getUserName(uuid) + " "; + accessors += userName + " "; } } for (UUID uuid : builderList) { final String userName = PlayerUtil.getInstance().getUserName(uuid); if (userName != null) { - builders += PlayerUtil.getInstance().getUserName(uuid) + " "; + builders += userName + " "; } } for (UUID uuid : containerList) { final String userName = PlayerUtil.getInstance().getUserName(uuid); if (userName != null) { - containers += PlayerUtil.getInstance().getUserName(uuid) + " "; + containers += userName + " "; } } for (UUID uuid : managerList) { final String userName = PlayerUtil.getInstance().getUserName(uuid); if (userName != null) { - managers += PlayerUtil.getInstance().getUserName(uuid) + " "; + managers += userName + " "; } } @@ -361,7 +361,7 @@ public void execute(CommandSender src, String[] args) { Component ownerLine = TextComponent.builder("") .append("Owner", TextColor.YELLOW) .append(" : ") - .append(ownerName != null && !claim.isAdminClaim() ? ownerName : "administrator", TextColor.GOLD).build(); + .append(ownerName != null && !claim.isAdminClaim() && !claim.isWilderness() ? ownerName : "administrator", TextColor.GOLD).build(); Component adminShowText = TextComponent.empty(); Component basicShowText = TextComponent.empty(); Component subdivisionShowText = TextComponent.empty(); diff --git a/bukkit/src/main/java/com/griefdefender/util/PlayerUtil.java b/bukkit/src/main/java/com/griefdefender/util/PlayerUtil.java index a8856a4..8106b76 100644 --- a/bukkit/src/main/java/com/griefdefender/util/PlayerUtil.java +++ b/bukkit/src/main/java/com/griefdefender/util/PlayerUtil.java @@ -99,6 +99,13 @@ public String lookupPlayerName(String uuid) { @Nullable public String getUserName(UUID uuid) { + if (uuid == GriefDefenderPlugin.PUBLIC_UUID) { + return "public"; + } + if (uuid == GriefDefenderPlugin.ADMIN_USER_UUID || uuid == GriefDefenderPlugin.WORLD_USER_UUID) { + return "administrator"; + } + final GDPermissionUser user = PermissionHolderCache.getInstance().getOrCreateUser(uuid); if (user == null) { return null;