From 230169e1631c3a17270903607cdde3f21357725a Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 15 Sep 2023 20:50:39 +0200 Subject: [PATCH 1/2] Unchecked schematics Signed-off-by: Lixfel --- .../fightsystem/FightSystem.properties | 2 ++ .../fightsystem/FightSystem_de.properties | 2 ++ .../de/steamwar/fightsystem/commands/GUI.java | 29 ++++++++++++------- .../steamwar/fightsystem/fight/FightTeam.java | 5 ++++ 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties index c60b91b..c2590cd 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem.properties @@ -75,6 +75,7 @@ KITSEARCH_TITLE=Search for kit SCHEM_NO_ENEMY=§cNo schematic selection without an opponent SCHEM_TITLE={0} selection SCHEM_PUBLIC=§ePublic {0} +SCHEM_UNCHECKED=§eUnchecked {0} SCHEM_PRIVATE=§ePrivate {0} SCHEM_NO_PRIVATE=§7No private {0} present SCHEM_PRIVATE_FORBIDDEN=§7No private {0} allowed @@ -99,6 +100,7 @@ SPECTATE_COUNTDOWN=until the arena is reset # Fight SCHEMATIC_UNLOADABLE=§cUnable to load schematic SCHEMATIC_CHOSEN=§7{0} §e{1} §7chosen +SCHEMATIC_UNCHECKED=§7Team {0} §7has chosen an §eunchecked §7schematic§8! TEAM_READY=§aTeam ready TEAM_NOT_READY=§c§mTeam ready SKIP_READY=§aSkipping to next event diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties index 415652c..62b7861 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties +++ b/FightSystem_Core/src/de/steamwar/fightsystem/FightSystem_de.properties @@ -69,6 +69,7 @@ KITSEARCH_TITLE=Nach Kit suchen SCHEM_NO_ENEMY=§cKeine Schematicwahl ohne Gegner SCHEM_TITLE={0}-Auswahl SCHEM_PUBLIC=§eÖffentliches {0} +SCHEM_UNCHECKED=§eUngeprüftes {0} SCHEM_PRIVATE=§ePrivates {0} SCHEM_NO_PRIVATE=§7Kein privates {0} vorhanden SCHEM_PRIVATE_FORBIDDEN=§7Kein privates {0} erlaubt @@ -93,6 +94,7 @@ SPECTATE_COUNTDOWN=bis die Arena zurückgesetzt wird # Fight SCHEMATIC_UNLOADABLE=§cSchematic konnte nicht geladen werden SCHEMATIC_CHOSEN=§7{0} §e{1} §7gewählt +SCHEMATIC_UNCHECKED=§7Team {0} §7hat eine §eungeprüfte §7Schematic gewählt§8! TEAM_READY=§aTeam bereit TEAM_NOT_READY=§c§mTeam bereit SKIP_READY=§aBeschleunigung zum nächsten Event diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java index cb63550..3c9a30d 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java @@ -170,24 +170,33 @@ public class GUI { SWInventory inv = new SWInventory(p, 9, msg.parse("SCHEM_TITLE", p, Config.GameName)); inv.setItem(8, Material.REDSTONE, msg.parse("SCHEM_PUBLIC", p, Config.GameName), (ClickType click) -> { p.closeInventory(); - schemDialog(p, true); + schemDialog(p, true, false); }); if(Fight.getMaxRank() == 0){ inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, Config.GameName), (ClickType click)->{}); - }else if(SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.toDB()).isEmpty() && !Config.test()){ - inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, Config.GameName), (ClickType click)->{}); - }else{ - inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, Config.GameName), (ClickType click) -> { - p.closeInventory(); - schemDialog(p, false); - }); + }else { + if (Config.SchematicType.checkType() != null && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.checkType().toDB()).isEmpty()) { + inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_UNCHECKED", p, Config.GameName), (ClickType click) -> { + p.closeInventory(); + schemDialog(p, false, true); + }); + } + + if(SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.toDB()).isEmpty() && !Config.test()){ + inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, Config.GameName), (ClickType click)->{}); + }else{ + inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, Config.GameName), (ClickType click) -> { + p.closeInventory(); + schemDialog(p, false, false); + }); + } } inv.setCallback(-999, (ClickType click) -> p.closeInventory()); inv.open(); } - private static void schemDialog(Player p, boolean publicSchems){ - SchematicSelector selector = new SchematicSelector(p, Config.test()?SchematicSelector.selectSchematic():SchematicSelector.selectSchematicTypeWithRank(Config.SchematicType, Fight.getMaxRank()), node -> { + private static void schemDialog(Player p, boolean publicSchems, boolean unchecked){ + SchematicSelector selector = new SchematicSelector(p, Config.test()?SchematicSelector.selectSchematic():SchematicSelector.selectSchematicTypeWithRank(unchecked ? Config.SchematicType.checkType() : Config.SchematicType, Fight.getMaxRank()), node -> { FightTeam fightTeam = Fight.getPlayerTeam(p); if(fightTeam == null) return; diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java index 74092af..94774aa 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightTeam.java @@ -393,6 +393,11 @@ public class FightTeam { } public void pasteSchem(SchematicNode schematic){ + if(schematic.getSchemtype().check()) { + FightStatistics.unrank(); + FightSystem.getMessage().broadcast("SCHEMATIC_UNCHECKED", getColoredName()); + } + setSchem(schematic); testPasteAction(); } -- 2.39.2 From 2cb9c12e46795951e9a49b8cd4a2ea7d0085c12d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 16 Sep 2023 11:09:41 +0200 Subject: [PATCH 2/2] Fix item and item location Signed-off-by: Lixfel --- FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java b/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java index 3c9a30d..ad3c273 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/commands/GUI.java @@ -176,7 +176,7 @@ public class GUI { inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, Config.GameName), (ClickType click)->{}); }else { if (Config.SchematicType.checkType() != null && !SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), Config.SchematicType.checkType().toDB()).isEmpty()) { - inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_UNCHECKED", p, Config.GameName), (ClickType click) -> { + inv.setItem(4, Material.ANVIL, msg.parse("SCHEM_UNCHECKED", p, Config.GameName), (ClickType click) -> { p.closeInventory(); schemDialog(p, false, true); }); -- 2.39.2