Skip to content

Commit

Permalink
Update method to retrieve player display name
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Feli499 committed Dec 31, 2023
1 parent a897576 commit 6bb5ca8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -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
*
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/Acrobot/ChestShop/UUIDs/NameManager.java
Expand Up @@ -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) {
Expand Down

0 comments on commit 6bb5ca8

Please sign in to comment.