From bc5542204ab9e18a414e484cc1660c56da9bda6d Mon Sep 17 00:00:00 2001 From: Chaos Date: Sat, 5 Feb 2022 12:29:22 +0100 Subject: [PATCH 1/5] Rework SchemInfo Add Back Button --- .../schematicsystem/commands/GUI.java | 91 +++++++++++-------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java index fbabed5..191bd12 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java @@ -47,18 +47,19 @@ public class GUI { inv.setItem(49, Material.AIR, "", clickType -> {}); } else { inv.setItem(49, Material.ANVIL, "§7Ordnereigenschaften", clickType -> { - info(selector.getPlayer(), parent); + info(selector.getPlayer(), parent, selector); }); } } - }, node -> info(player, node)); + }, node -> {}); + selector.setCallback(node -> info(player, node, selector)); selector.setSingleDirOpen(false); selector.open(); } - private static void info(Player player, SchematicNode node) { + private static void info(Player player, SchematicNode node, SchematicSelector back) { SteamwarUser user = getUser(player); - SWInventory inv = new SWInventory(player, 9, node.generateBreadcrumbs(user)); + SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs(user)); if(!node.isDir()) { inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), "§eLaden", click -> { player.closeInventory(); @@ -66,6 +67,14 @@ public class GUI { }); } + inv.setItem(9, SWItem.getMaterial("LEASH"), "§eZurück", clickType -> { + if(back != null) { + back.reOpen(); + } else { + list(player); + } + }); + if(node.getOwner() == user.getId()){ if(!node.isDir() && node.getSchemtype().writeable()){ List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); @@ -80,16 +89,14 @@ public class GUI { } Material mat = SWItem.getMaterial(node.getItem()); - inv.setItem(2, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { - player.closeInventory(); - changeItem(player, node); + inv.setItem(5, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { + changeItem(player, node, back); }); if(!node.isDir()) { - inv.setItem(3, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { - player.closeInventory(); - changeType(player, node); + inv.setItem(6, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), node.getSchemtype().fightType(), click -> { + changeType(player, node, back); }); - inv.setItem(4, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> { + inv.setItem(7, SWItem.getMaterial("MAGENTA_GLAZED_TERRACOTTA"), "§eDownload", click -> { player.closeInventory(); SchematicCommandUtils.download(player, node); }); @@ -100,12 +107,12 @@ public class GUI { delmembers(player, node); }); skull.setName("§eMitglieder"); - inv.setItem(5, skull); - inv.setItem(6, Material.ARROW, "§eVerschieben", clickType -> { + inv.setItem(8, skull); + inv.setItem(15, Material.ARROW, "§eVerschieben", clickType -> { SchematicSelector selector = new SchematicSelector(player, SchematicSelector.selectDirectory(), npar -> { SafeSchematicNode.Result result = SafeSchematicNode.setParent(user, node, npar); if(result.isSuccessful()) { - info(player, SchematicNode.getSchematicNode(node.getId())); + info(player, SchematicNode.getSchematicNode(node.getId()), back); } else { result.sendError(player); } @@ -113,44 +120,44 @@ public class GUI { selector.open(); }); Material finalMat = mat; - inv.setItem(7, Material.NAME_TAG, "§eUmbenennen", clickType -> { + inv.setItem(16, Material.NAME_TAG, "§eUmbenennen", clickType -> { SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen", node.getName()); anvilInv.setItem(finalMat); anvilInv.setCallback(s -> { SafeSchematicNode.Result result = SafeSchematicNode.setName(user, node, s); if(result.isSuccessful()) { - info(player, node); + info(player, node, back); } else { result.sendError(player); } }); anvilInv.open(); }); - inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { - player.closeInventory(); - delete(player, node); + inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cLöschen", click -> { + delete(player, node, back); }); }else{ if(!node.isDir()) { - inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), click -> {}); + inv.setItem(4, SWItem.getMaterial("CAULDRON_ITEM"), "§e" + node.getSchemtype().name(), Collections.emptyList(), node.getSchemtype().fightType(), click -> {}); } SteamwarUser owneruser = SteamwarUser.get(node.getOwner()); SWItem skull = SWItem.getPlayerSkull(owneruser.getUserName()); skull.setName("§7von §e" + owneruser.getUserName()); - inv.setItem(6, skull.getItemStack(), clickType -> {}); + inv.setItem(8, skull.getItemStack(), clickType -> {}); - inv.setItem(8, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> { - player.closeInventory(); - delete(player, node); - }); + if(NodeMember.getNodeMember(node.getId(), user.getId()) != null) { + inv.setItem(17, SWItem.getDye(1), (byte) 1, "§cZugriff entfernen", click -> { + delete(player, node, back); + }); + } } inv.setCallback(-999, click -> player.closeInventory()); inv.open(); } - static void changeType(Player p, SchematicNode schem){ + static void changeType(Player p, SchematicNode schem, SchematicSelector back){ List> types = new LinkedList<>(); for(SchematicType type : SchematicType.values()){ if(!type.isAssignable()) @@ -164,28 +171,34 @@ public class GUI { } SWListInv inv = new SWListInv<>(p, "Typ ändern", types, (clickType, schematicType) -> { - p.closeInventory(); SchematicCommandUtils.changeType(p, schem, schematicType, null); + info(p, schem, back); }); inv.setCallback(-999, (ClickType click) -> p.closeInventory()); inv.open(); } - private static void deleteOwn(Player p, SchematicNode schem){ + private static void deleteOwn(Player p, SchematicNode schem, SchematicSelector back){ 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(); p.sendMessage(SchematicSystem.PREFIX + "Schematic §e" + schem.generateBreadcrumbs(user) + " §7gelöscht"); - p.closeInventory(); + if(back != null) { + if(schem.isDir()) { + back.reOpenDirUp(); + } else { + back.reOpen(); + } + } }); inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory()); inv.setCallback(-999, click -> p.closeInventory()); inv.open(); } - private static void deleteMembership(Player p, SchematicNode schem){ + private static void deleteMembership(Player p, SchematicNode schem, SchematicSelector back){ 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 -> { @@ -193,18 +206,24 @@ public class GUI { if(member != null) member.delete(); p.sendMessage(SchematicSystem.PREFIX + "Zugriff zu Schematic §e" + schem.generateBreadcrumbs(user) + " §7entfernt"); - p.closeInventory(); + if(back != null) { + if(schem.isDir()) { + back.reOpenDirUp(); + } else { + back.reOpen(); + } + } }); inv.setItem(8, SWItem.getDye(14), (byte) 14, "§cAbbruch", click -> p.closeInventory()); inv.setCallback(-999, click -> p.closeInventory()); inv.open(); } - static void delete(Player p, SchematicNode schem){ + static void delete(Player p, SchematicNode schem, SchematicSelector back){ if(SteamwarUser.get(p.getUniqueId()).getId() == schem.getOwner()) - deleteOwn(p, schem); + deleteOwn(p, schem, back); else - deleteMembership(p, schem); + deleteMembership(p, schem, back); } static void delmembers(Player p, SchematicNode schem){ @@ -223,11 +242,11 @@ public class GUI { inv.open(); } - private static void changeItem(Player p, SchematicNode schem){ + private static void changeItem(Player p, SchematicNode schem, SchematicSelector back){ UtilGui.openMaterialSelector(p, "Item ändern", material -> { schem.setItem(material.name()); p.closeInventory(); - info(p, schem); + info(p, schem, back); }); } } From 310c28d54b95f24e1e169010c3846a52deffe019 Mon Sep 17 00:00:00 2001 From: Chaos Date: Mon, 7 Feb 2022 09:37:19 +0100 Subject: [PATCH 2/5] Optimizing GUI --- .../src/de/steamwar/schematicsystem/commands/GUI.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java index 191bd12..c7ff849 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java @@ -68,11 +68,7 @@ public class GUI { } inv.setItem(9, SWItem.getMaterial("LEASH"), "§eZurück", clickType -> { - if(back != null) { - back.reOpen(); - } else { - list(player); - } + back.reOpen(); }); if(node.getOwner() == user.getId()){ @@ -119,10 +115,9 @@ public class GUI { }); selector.open(); }); - Material finalMat = mat; inv.setItem(16, Material.NAME_TAG, "§eUmbenennen", clickType -> { SWAnvilInv anvilInv = new SWAnvilInv(player, node.getName() + " umbenennen", node.getName()); - anvilInv.setItem(finalMat); + anvilInv.setItem(mat); anvilInv.setCallback(s -> { SafeSchematicNode.Result result = SafeSchematicNode.setName(user, node, s); if(result.isSuccessful()) { From 86888e708fac69e8462dec3b20834a82b1e98759 Mon Sep 17 00:00:00 2001 From: Chaos Date: Wed, 9 Feb 2022 18:40:34 +0100 Subject: [PATCH 3/5] Rebuild --- .../steamwar/schematicsystem/commands/SchematicCommandHelp.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java index 871ed06..78dab28 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java @@ -26,7 +26,6 @@ import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; public class SchematicCommandHelp { - private SchematicCommandHelp() { } From 7f3725842f49f1a8dbc373709ab452fda6e4c784 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 11 Feb 2022 17:51:04 +0100 Subject: [PATCH 4/5] test(security): Commit Signing Signed-off-by: Chaos --- SchematicSystem_Core/src/plugin.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/SchematicSystem_Core/src/plugin.yml b/SchematicSystem_Core/src/plugin.yml index 457fdd9..931046c 100644 --- a/SchematicSystem_Core/src/plugin.yml +++ b/SchematicSystem_Core/src/plugin.yml @@ -5,5 +5,6 @@ depend: [SpigotCore, WorldEdit] main: de.steamwar.schematicsystem.SchematicSystem website: steamwar.de api-version: "1.13" +description: Schematic-Frontend commands: \ No newline at end of file From 40ac248553543fad2310d99e853a4419ad7c5caa Mon Sep 17 00:00:00 2001 From: Chaos Date: Fri, 11 Feb 2022 17:56:00 +0100 Subject: [PATCH 5/5] test(security): Commit Signing 2 Signed-off-by: Chaos --- SchematicSystem_Core/src/plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchematicSystem_Core/src/plugin.yml b/SchematicSystem_Core/src/plugin.yml index 931046c..b756bec 100644 --- a/SchematicSystem_Core/src/plugin.yml +++ b/SchematicSystem_Core/src/plugin.yml @@ -7,4 +7,4 @@ website: steamwar.de api-version: "1.13" description: Schematic-Frontend -commands: \ No newline at end of file +commands: