From 6bb5ca878184e795a429fd33ff0aebb95f0d4ba7 Mon Sep 17 00:00:00 2001 From: Maik E Date: Sun, 31 Dec 2023 17:01:33 +0100 Subject: [PATCH] Update method to retrieve player display name The getNameFor method in NameManager.java file has been updated to return the player's display name instead of their UUID. Additionally, MaterialUtil library has been imported in PreShopCreationEvent class to fetch the name of the item type for the given ItemStack, which is then set as the third line of signLines. --- .../com/Acrobot/ChestShop/Events/PreShopCreationEvent.java | 4 ++++ src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java b/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java index 8cb9e0cfe..7e32f2b30 100644 --- a/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java +++ b/src/main/java/com/Acrobot/ChestShop/Events/PreShopCreationEvent.java @@ -6,6 +6,8 @@ import org.bukkit.event.HandlerList; import org.bukkit.inventory.ItemStack; +import com.Acrobot.Breeze.Utils.MaterialUtil; + /** * Represents a state before shop is created * @@ -28,6 +30,8 @@ public PreShopCreationEvent(Player creator, Sign sign, String[] signLines, ItemS this.itemStack = itemStack; if (itemStack == null) outcome = CreationOutcome.INVALID_ITEM; + else + this.signLines[3] = MaterialUtil.getName(itemStack.getType()); } public String getQuantityLine() { diff --git a/src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java b/src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java index 2f3b43030..76147f6ad 100644 --- a/src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java +++ b/src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java @@ -39,7 +39,7 @@ public class NameManager { private static UUID serverAccountUUID; public static String getNameFor(Player player) { - return currentShortName.get(player.getUniqueId()); + return player.getDisplayName(); } public static UUID getUUIDForFullName(String name) {