diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index de9d76e8..0ed5e554 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -573,7 +573,10 @@ SIMULATOR_GUI_MOVE_ALL = §eMove all SIMULATOR_MOVE_ALL_GUI_NAME = Move TNT -SIMULATOR_TNT_SPAWN_GUI_NAME = Configure TNT +SIMULATOR_TNT_SPAWN_GUI_NAME = Configure TNT {0} +SIMULATOR_TNT_SPAWN_EDIT_LOCATION = - Location +SIMULATOR_TNT_SPAWN_EDIT_PROPERTIES = - Properties +SIMULATOR_TNT_SPAWN_EDIT_OTHER = - Other SIMULATOR_TNT_SPAWN_LORE = §eClick to change SIMULATOR_TNT_SPAWN_COUNT = §7TNT-Count §8- §e{0} SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME = TNT-Count diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index e4ce7d74..41615b55 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -560,7 +560,7 @@ SIMULATOR_GUI_MOVE_ALL = §eAlle Verschieben SIMULATOR_MOVE_ALL_GUI_NAME = TNT Verschieben -SIMULATOR_TNT_SPAWN_GUI_NAME = TNT konfigurieren +SIMULATOR_TNT_SPAWN_GUI_NAME = TNT konfigurieren {0} SIMULATOR_TNT_SPAWN_LORE = §eZum Ändern klicken SIMULATOR_TNT_SPAWN_COUNT = §7TNT-Anzahl §8- §e{0} SIMULATOR_TNT_SPAWN_COUNT_ANVIL_GUI_NAME = Anzahl TNT diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTElementGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTElementGUI.java index ea2a8365..ca05905d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTElementGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTElementGUI.java @@ -33,13 +33,18 @@ import java.util.List; @UtilityClass public class TNTElementGUI { - public void open(Player player, TNTElement tntElement, Runnable back) { - SWInventory inv = new SWInventory(player, 45, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_GUI_NAME", player)); + private SWInventory open(Player player, String name) { + SWInventory inv = new SWInventory(player, 45, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_GUI_NAME", player, name)); SWItem gray = new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§f", clickType -> {}); for (int i = 0; i < 9; i++) { inv.setItem(i, gray); inv.setItem(i + 36, gray); } + return inv; + } + + public void open(Player player, TNTElement tntElement, Runnable back) { + SWInventory inv = open(player, ""); if (back != null) { inv.setItem(36, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> back.run())); } @@ -50,7 +55,7 @@ public class TNTElementGUI { locationLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_Y", player, tntElement.getPosition().getY())); locationLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_POSITION_Z", player, tntElement.getPosition().getZ())); inv.setItem(20, new SWItem(Material.PAPER, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_LOCATION", player), locationLore, false, clickType -> { - + editLocation(player, tntElement, () -> open(player, tntElement, back)); })); List propertiesLore = new ArrayList<>(); @@ -63,7 +68,7 @@ public class TNTElementGUI { propertiesLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Y", player, active(player, tntElement.isYVelocity()))); propertiesLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_Z", player, active(player, tntElement.isZVelocity()))); inv.setItem(22, new SWItem(Material.TNT, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_PROPERTIES", player), propertiesLore, false, clickType -> { - + editProperties(player, tntElement, () -> open(player, tntElement, back)); })); List otherLore = new ArrayList<>(); @@ -71,12 +76,39 @@ public class TNTElementGUI { otherLore.add(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ACTIVATED_WITH", player, activationType(player, tntElement.getOrder()))); otherLore.add(BauSystem.MESSAGE.parse("SIMULATOR_MATERIAL_NAME_LORE", player, tntElement.getMaterial().name())); inv.setItem(24, new SWItem(Material.ANVIL, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_OTHER", player), otherLore, false, clickType -> { - + editOther(player, tntElement, () -> open(player, tntElement, back)); })); inv.open(); } + private void editLocation(Player player, TNTElement tntElement, Runnable back) { + SWInventory inv = open(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_EDIT_LOCATION", player)); + if (back != null) { + inv.setItem(36, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> back.run())); + } + + inv.open(); + } + + private void editProperties(Player player, TNTElement tntElement, Runnable back) { + SWInventory inv = open(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_EDIT_PROPERTIES", player)); + if (back != null) { + inv.setItem(36, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> back.run())); + } + + inv.open(); + } + + private void editOther(Player player, TNTElement tntElement, Runnable back) { + SWInventory inv = open(player, BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_EDIT_OTHER", player)); + if (back != null) { + inv.setItem(36, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("SIMULATOR_BACK", player), clickType -> back.run())); + } + + inv.open(); + } + private String active(Player p, boolean active) { return active ? BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_ON", p) : BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_VELOCITY_OFF", p); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTSimulatorGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTSimulatorGui.java index b6e654a6..61c4382b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTSimulatorGui.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulatorn/gui/TNTSimulatorGui.java @@ -27,7 +27,6 @@ import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; import lombok.experimental.UtilityClass; import org.bukkit.Material; -import org.bukkit.block.data.type.TNT; import org.bukkit.entity.Player; import org.bukkit.util.Vector;