From c6f37579a09dfb4db139b9d7839a9bcefef4dd1b Mon Sep 17 00:00:00 2001
From: ineanto <ineanto@ineanto.xyz>
Date: Sun, 8 Jun 2025 13:31:04 +0200
Subject: [PATCH] fix(gui/admin): player info item name
---
CHANGELOG.log | 1 +
.../nicko/gui/items/admin/check/PlayerInformationItem.java | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.log b/CHANGELOG.log
index 718b882..088f3a2 100644
--- a/CHANGELOG.log
+++ b/CHANGELOG.log
@@ -3,6 +3,7 @@
- Players are now able to mark disguises as favorites.
[FIXES]
+ - Fixed a bug where a player was improperly named when inspecting it in the admin panel.
- Added a missing sound when players undisguised.
1.2.0-RC1: Update n°12 (XX/XX/25)
diff --git a/src/main/java/xyz/ineanto/nicko/gui/items/admin/check/PlayerInformationItem.java b/src/main/java/xyz/ineanto/nicko/gui/items/admin/check/PlayerInformationItem.java
index 6e396a0..f3c61f2 100644
--- a/src/main/java/xyz/ineanto/nicko/gui/items/admin/check/PlayerInformationItem.java
+++ b/src/main/java/xyz/ineanto/nicko/gui/items/admin/check/PlayerInformationItem.java
@@ -16,6 +16,7 @@ import xyz.ineanto.nicko.gui.items.common.choice.ChoiceCallback;
import xyz.ineanto.nicko.language.LanguageKey;
import xyz.ineanto.nicko.language.PlayerLanguage;
import xyz.ineanto.nicko.profile.NickoProfile;
+import xyz.ineanto.nicko.storage.name.PlayerNameStore;
import xyz.xenondevs.invui.item.builder.AbstractItemBuilder;
import xyz.xenondevs.invui.item.builder.ItemBuilder;
import xyz.xenondevs.invui.item.builder.SkullBuilder;
@@ -35,15 +36,16 @@ public class PlayerInformationItem extends AsyncItem {
super(new SuppliedItem(() -> {
final ItemBuilder builder = new ItemBuilder(Material.PAINTING);
return playerLanguage.translateItem(builder, LanguageKey.GUI.LOADING);
- }, (click -> true)).getItemProvider(), () -> {
+ }, (_ -> true)).getItemProvider(), () -> {
try {
final SkullBuilder skull = new SkullBuilder(target.getUniqueId());
final Optional<NickoProfile> optionalProfile = Nicko.getInstance().getDataStore().getData(target.getUniqueId());
+ final PlayerNameStore playerNameStore = Nicko.getInstance().getNameStore();
if (optionalProfile.isPresent()) {
final NickoProfile profile = optionalProfile.get();
final AbstractItemBuilder<?> headItem = playerLanguage.translateItem(skull, LanguageKey.GUI.Admin.CHECK,
- target.getName(),
+ playerNameStore.getStoredName(target),
(profile.hasData() ? "<green>✔</green>" : "<red>❌</red>"),
(profile.getName() == null ? "<grey>N/A<grey>" : profile.getName()),
(profile.getSkin() == null ? "<grey>N/A</grey>" : profile.getSkin()));