fix(gui/admin): player info item name

This commit is contained in:
ineanto 2025-06-08 13:31:04 +02:00
parent e8ac7619de
commit c6f37579a0
Signed by: ineanto
GPG key ID: E511F9CAA2F9CE84
2 changed files with 5 additions and 2 deletions

View file

@ -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()));