From b59ff373b13409030294469ab12bf22bd58467c7 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 27 Jul 2021 12:14:57 +0200 Subject: [PATCH] More Public Signed-off-by: Chaoscaot --- .../de/steamwar/schematicsystem/commands/GUI.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java index 33a5f8d..38c3cd7 100644 --- a/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Main/src/de/steamwar/schematicsystem/commands/GUI.java @@ -32,10 +32,12 @@ import org.bukkit.event.inventory.ClickType; import java.util.*; +import static de.steamwar.schematicsystem.commands.SchematicCommandUtils.getUser; + public class GUI { public static void open(Player player) { - list(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), null), false, "/"); + list(player, SchematicNode.getSchematicsAccessibleByUser(getUser(player).getId(), null), false, "/"); } private static void list(Player player, List schems, boolean publics, String path) { @@ -48,7 +50,8 @@ public class GUI { else m = SWItem.getMaterial(schem.getItem()); - SWItem item = new SWItem(m, "§e" + schem.getName(), Collections.singletonList(schem.isDir()?"§9Ordner":"§7" + schem.getSchemtype().name()), schem.isDir()?false:!schem.getSchemtype().writeable(), click -> {}); + SWItem item = new SWItem(m, "§e" + schem.getName(), Collections.singletonList(schem.isDir() ? "§9Ordner" : "§7" + schem.getSchemtype().name()), !schem.isDir() && !schem.getSchemtype().writeable(), click -> { + }); if(!schem.isDir()) { if(schem.getRank() > 0) item.setLore(Lists.newArrayList("§7" + schem.getSchemtype().name(), "§8Rang " + schem.getRank())); @@ -66,7 +69,7 @@ public class GUI { } private static void info(Player player, SchematicNode node) { - SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + SteamwarUser user = getUser(player); if(node.isDir()) { list(player, SchematicNode.getSchematicNodeInNode(node), node.getOwner() == 0, node.generateBreadcrumbs(user)); } else { @@ -156,7 +159,7 @@ public class GUI { } private static void deleteOwn(Player p, SchematicNode schem){ - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); + SteamwarUser user = getUser(p); SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " löschen"); inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eLöschen", click -> { schem.delete(); @@ -174,7 +177,7 @@ public class GUI { } private static void deleteMembership(Player p, SchematicNode schem){ - SteamwarUser user = SteamwarUser.get(p.getUniqueId()); + SteamwarUser user = getUser(p); SWInventory inv = new SWInventory(p, 9, schem.generateBreadcrumbs(user) + " entfernen"); inv.setItem(0, SWItem.getDye(1), (byte) 1, "§eZugriff entfernen", click -> { NodeMember member = NodeMember.getNodeMember(schem.getId(), user.getId()); @@ -232,7 +235,7 @@ public class GUI { SWAnvilInv inv = new SWAnvilInv(player, "Schematics suchen"); inv.setItem(SWItem.getMaterial("CAULDRON_ITEM")); inv.setCallback(s -> { - SteamwarUser user = SteamwarUser.get(player.getUniqueId()); + SteamwarUser user = getUser(player); list(player, SchematicNode.filterSchems(publics?0:user.getId(), node -> node.getName().contains(s)), publics, "/"); }); inv.open();