From fc155f653d0f5532ce5919e532057fd4a032d30d Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 15 Mar 2022 08:59:22 +0100 Subject: [PATCH 1/4] Integrate replay and color options Signed-off-by: Lixfel --- .../commands/SchematicCommand.java | 7 +++- .../commands/SchematicCommandUtils.java | 38 ++++++++++++------- pom.xml | 1 + 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 1260878..50df954 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -30,7 +30,6 @@ import de.steamwar.schematicsystem.SchematicSystem; import de.steamwar.sql.*; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.ComponentBuilder; import net.md_5.bungee.api.chat.HoverEvent; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; @@ -362,6 +361,12 @@ public class SchematicCommand extends SWCommand { SchematicCommandUtils.download(player, node); } + @Register("lockreplay") + public void lockreplay(Player player, SchematicNode node) { + node.setAllowReplay(false); + player.sendMessage(SchematicSystem.PREFIX + "Replays von Kämpfen mit " + node.getName() + " können ab sofort nicht mehr betrachtet werden"); + } + @Register("dir") @Register("ordner") @Register("mkdir") diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index 8f35220..fd580c9 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -407,23 +407,35 @@ public class SchematicCommandUtils { } if (extend == null) { - SWInventory inv = new SWInventory(player, 9, "Schematic ausfahren"); - inv.setItem(0, SWItem.getDye(10), (byte) 10, "§eSchematic ausfahren", click -> { - new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player); - player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet"); - player.closeInventory(); - }); - inv.setItem(8, SWItem.getDye(7), (byte) 7, "§eDirekt einsenden", click -> { - node.setSchemtype(type.checkType()); - player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft"); - player.closeInventory(); - }); - inv.setCallback(-999, click -> player.closeInventory()); - inv.open(); + submitSchemGUI(player, node, type); } else if (extend == SchematicCommand.Extend.AUSFAHREN) { new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player); player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet"); } } } + + private static void submitSchemGUI(Player player, SchematicNode node, SchematicType type) { + SWInventory inv = new SWInventory(player, 9, "Schematic ausfahren"); + inv.setItem(0, SWItem.getMaterial("SIGN"), node.allowReplay() ? "§cReplay sperren" : "§aReplay erlauben", click -> { + node.setAllowReplay(!node.allowReplay()); + submitSchemGUI(player, node, type); + }); + inv.setItem(1, SWItem.getMaterial("PINK_WOOL"), node.replaceColor() ? "§cPink nicht zu Teamfarbe ersetzen" : "§aPink zu Teamfarbe ersetzen", click -> { + node.setReplaceColor(!node.replaceColor()); + submitSchemGUI(player, node, type); + }); + inv.setItem(7, SWItem.getDye(7), (byte) 7, "§eDirekt einsenden", click -> { + node.setSchemtype(type.checkType()); + player.sendMessage(SchematicSystem.PREFIX + "§aDie Schematic wird zeitnah überprüft"); + player.closeInventory(); + }); + inv.setItem(8, SWItem.getDye(10), (byte) 10, "§eSchematic ausfahren", click -> { + new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()), node, type).send(player); + player.sendMessage(SchematicSystem.PREFIX + "§aDer Vorbereitungsserver wird gestartet"); + player.closeInventory(); + }); + inv.setCallback(-999, click -> player.closeInventory()); + inv.open(); + } } diff --git a/pom.xml b/pom.xml index cc39eaa..d1b542e 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ 1.8 1.8 + -Xlint From a690baf3486403c61f1976081e1d6a838ec1eb6f Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 15 Mar 2022 12:20:17 +0100 Subject: [PATCH 2/4] Toggle color Signed-off-by: Lixfel --- .../schematicsystem/commands/SchematicCommandUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index fd580c9..cb1064e 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -421,7 +421,7 @@ public class SchematicCommandUtils { node.setAllowReplay(!node.allowReplay()); submitSchemGUI(player, node, type); }); - inv.setItem(1, SWItem.getMaterial("PINK_WOOL"), node.replaceColor() ? "§cPink nicht zu Teamfarbe ersetzen" : "§aPink zu Teamfarbe ersetzen", click -> { + inv.setItem(1, SWItem.getMaterial(node.replaceColor() ? "PINK_WOOL" : "LIGHT_GRAY_WOOL"), node.replaceColor() ? "§cPink nicht zu Teamfarbe ersetzen" : "§aPink zu Teamfarbe ersetzen", click -> { node.setReplaceColor(!node.replaceColor()); submitSchemGUI(player, node, type); }); From 2893325be342e87cd93c9a5e1f20174800fcfca6 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Tue, 15 Mar 2022 16:18:56 +0100 Subject: [PATCH 3/4] More options Signed-off-by: Lixfel --- .../schematicsystem/commands/SchematicCommand.java | 7 +++++++ .../schematicsystem/commands/SchematicCommandHelp.java | 2 ++ .../schematicsystem/commands/SchematicCommandUtils.java | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java index 50df954..77c02bc 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java @@ -367,6 +367,13 @@ public class SchematicCommand extends SWCommand { player.sendMessage(SchematicSystem.PREFIX + "Replays von Kämpfen mit " + node.getName() + " können ab sofort nicht mehr betrachtet werden"); } + @Register("replacecolor") + public void replacecolor(Player player, SchematicNode node) { + boolean state = !node.replaceColor(); + node.setReplaceColor(state); + player.sendMessage(SchematicSystem.PREFIX + "In Kämpfen " + node.getName() + " werden pinke Blöcke " + (state ? "" : "nicht ") + "ersetzt"); + } + @Register("dir") @Register("ordner") @Register("mkdir") diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java index 78dab28..b5d00da 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandHelp.java @@ -62,6 +62,8 @@ public class SchematicCommandHelp { "§8/§7schem §emove §8[§7Schematic§8] [§7Neuer Pfad§8] - §7Verschiebe eine Schematic", "§8/§7schem §erename §8[§7Schematic§8] [§7Neuer Name§8] - §7Gib der Schematic einen neuen Namen", "§8/§7schem §echangetype §8[§7Schematic§8] - §7Ändert die Art deiner Schematic", + "§8/§7schem §elockreplay §8[§7Schematic§8] - §7Sperrt Replays mit der Schematic", + "§8/§7schem §ereplacecolor §8[§7Schematic§8] - §7Ändert Farbersetzung in der Arena", "§8/§7schem §edelete §8[§7Schematic§8] - §7Löscht eine Schematic" }), MEMBER("Besitzrechte", "Schematics mit anderen teilen", new String[]{ diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java index cb1064e..50ec7b6 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommandUtils.java @@ -195,6 +195,12 @@ public class SchematicCommandUtils { if (node.getRank() > 0) { player.sendMessage("§7Rang: §e" + node.getRank()); } + + if (node.getSchemtype().fightType()) { + player.sendMessage("§7Farbersetzung: §e" + (node.replaceColor() ? "ja" : "nein")); + player.sendMessage("§7Replaywiedergabe: §e" + (node.allowReplay() ? "gestattet" : "untersagt")); + } + player.sendMessage("§7Format: §e" + (node.getSchemFormat() ? ".schem" : ".schematic")); List checkedSchematics = CheckedSchematic.getLastDeclined(player.getUniqueId()); for (CheckedSchematic checkedSchematic : checkedSchematics) { From 938ace0e3188f74ceaf3e1ea43eda3c226525663 Mon Sep 17 00:00:00 2001 From: Chaos Date: Tue, 15 Mar 2022 17:27:13 +0100 Subject: [PATCH 4/4] feat(replay-color): Add GUI Signed-off-by: Chaos --- .../schematicsystem/commands/GUI.java | 21 ++++++++++++++++++- pom.xml | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java index 24d621e..f67d0ca 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/GUI.java @@ -85,7 +85,7 @@ public class GUI { } Material mat = SWItem.getMaterial(node.getItem()); - inv.setItem(5, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { + inv.setItem(node.isDir()?7:5, mat, "§e" + mat.name(), Arrays.asList("§7Zum Ändern", "§7anklicken"), false, click -> { changeItem(player, node, back); }); if(!node.isDir()) { @@ -96,6 +96,25 @@ public class GUI { player.closeInventory(); SchematicCommandUtils.download(player, node); }); + if(node.getSchemtype().fightType()) { + inv.setItem(14, SWItem.getMaterial(node.replaceColor() ? "PINK_WOOL" : "LIGHT_GRAY_WOOL"), "Farbersetzung", Arrays.asList("§7Aktuell: " + (node.replaceColor()?"§aAn":"§cAus"), "§7Zum Ändern", "§7anklicken"), false, clickType -> { + node.setReplaceColor(!node.replaceColor()); + info(player, node, back); + }); + inv.setItem(13, SWItem.getMaterial(node.allowReplay() ? "EYE_OF_ENDER" : "ENDER_PEAR"), "Replay Wiedergabe", Arrays.asList("§7Aktuell: " + (node.replaceColor()?"§aAn":"§4Aus"), "§7Zum §lAusschaulten", "§7anklicken"), false, clickType -> { + if(node.allowReplay()) { + SWInventory confInv = new SWInventory(player, 9, "Wiedergabe der Schematic Dauerhaft sperren"); + confInv.setItem(0, SWItem.getDye(1), (byte) 1, "§aAbbrechen", type -> { + info(player, node, back); + }); + confInv.setItem(8, SWItem.getDye(10), (byte) 10, "§cBestätigen", type -> { + node.setAllowReplay(false); + info(player, node, back); + }); + confInv.open(); + } + }); + } } SWItem skull = SWItem.getPlayerSkull("MHF_STEVE"); skull.setCallback(click -> { diff --git a/pom.xml b/pom.xml index d1b542e..411fb62 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,7 @@ org.projectlombok lombok 1.18.22 + provided \ No newline at end of file