From e24c0296d006b03bc0b31dd7a2d1d9654f09d1d7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 26 Dec 2020 22:04:45 +0100 Subject: [PATCH] Fix heads to utilise SWItem-API Signed-off-by: Lixfel --- .../steamwar/schematicsystem/commands/GUI.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index f7e9771..d14f7ea 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -26,11 +26,9 @@ import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.sql.*; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.meta.SkullMeta; import java.util.*; @@ -102,7 +100,7 @@ class GUI { List> members = new LinkedList<>(); for(SchematicMember member : SchematicMember.getSchemMembers(schem.getSchemName(), schem.getSchemOwner())){ SteamwarUser user = SteamwarUser.get(member.getMember()); - members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(Bukkit.getOfflinePlayer(user.getUUID())), member)); + members.add(new SWListInv.SWListEntry<>(SWItem.getPlayerSkull(user.getUserName()), member)); } SWListInv inv = new SWListInv<>(p, "Mitglieder entfernen", members, (clickType, member) -> { @@ -169,10 +167,13 @@ class GUI { p.closeInventory(); SchematicCommand.download(p, schem); }); - inv.setItem(6, SWItem.getMaterial("SKULL_ITEM"), "§eMitglieder", click -> { + SWItem skull = SWItem.getPlayerSkull("MHF_STEVE"); + skull.setCallback(click -> { p.closeInventory(); delmembers(p, schem); }); + skull.setName("§eMitglieder"); + inv.setItem(6, skull); inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { p.closeInventory(); delete(p, schem); @@ -181,12 +182,9 @@ class GUI { inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + schem.getSchemType().name(), click -> {}); SteamwarUser owneruser = SteamwarUser.get(schem.getSchemOwner()); - SWItem owner = SWItem.getPlayerSkull(owneruser.getUserName()); - SkullMeta headmeta = (SkullMeta)owner.getItemMeta(); - headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(owneruser.getUUID())); - headmeta.setDisplayName("§7von §e" + owneruser.getUserName()); - owner.setItemMeta(headmeta); - inv.setItem(6, owner); + SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName()); + skull.setName("§7von §e" + owneruser.getUserName()); + inv.setItem(6, skull); inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> { p.closeInventory();