From c327471ef2faf62d139c34507f3b1827ec59703e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 11 Jun 2022 13:10:26 +0200 Subject: [PATCH] Update stuff Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 12 ++++++++---- BauSystem_Main/src/BauSystem_de.properties | 12 ++++++++---- .../bausystem/features/simulator/OrderUtils.java | 3 +-- .../features/simulator/SimulatorStorage.java | 13 +++++-------- .../simulator/gui/SimulatorSelectionGUI.java | 2 +- .../features/simulator/gui/TNTSimulatorGui.java | 2 +- .../features/simulator/tnt/TNTElement.java | 11 ++++++----- 7 files changed, 30 insertions(+), 25 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 7bcff795..f13c0c42 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -513,8 +513,10 @@ SIMULATOR_CREATE = §aSimulator created SIMULATOR_EDIT_LOCATION = §7Edit position SIMULATOR_EDIT_PROPERTIES = §7Edit properties SIMULATOR_EDIT_OTHER = §7Edit other +SIMULATOR_EDIT_GROUP = §7Edit group SIMULATOR_WAND_NAME = §eSimulator +SIMULATOR_WAND_NAME_SELECTED = §7Simulator §8- §e{0} SIMULATOR_WAND_LORE_1 = §eRigth click §8- §7adds a position SIMULATOR_WAND_LORE_2 = §eSneaking §8- §7Free movement SIMULATOR_WAND_LORE_3 = §eLeft click §8- §7Start the simulation @@ -540,10 +542,11 @@ SIMULATOR_POSITION_ADD = §eSet position SIMULATOR_GUI_TNT_SPAWN_NAME = §eTNT SIMULATOR_GUI_TNT_SPAWN_LORE_1 = §7TNT-Count§8: §e{0} SIMULATOR_GUI_TNT_SPAWN_LORE_2 = §7Tick§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7 -SIMULATOR_GUI_TNT_SPAWN_LORE_4 = §7x§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_5 = §7y§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_6 = §7z§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7Lifespan§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_4 = §7 +SIMULATOR_GUI_TNT_SPAWN_LORE_5 = §7x§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_6 = §7y§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_7 = §7z§8: §e{0} SIMULATOR_GUI_TNT_GROUP_NAME = §eTNT group SIMULATOR_GUI_TNT_GROUP_LORE_1 = §7Element count§8: §e{0} SIMULATOR_GUI_TNT_DISABLED = §cDisabled @@ -579,6 +582,7 @@ SIMULATOR_TNT_SPAWN_ACTIVATED_NAME = §7Primed by SIMULATOR_TNT_SPAWN_ACTIVATED_WITH = §7Primed by §8- §e{0} SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER = Observer SIMULATOR_TNT_SPAWN_ACTIVATED_UNKNOWN = Unknown SIMULATOR_TNT_SPAWN_INACTIVE = §7> §7{0} SIMULATOR_TNT_SPAWN_ACTIVE = §e> §7{0} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index bcf62f73..5cd44ad3 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -514,8 +514,10 @@ SIMULATOR_CREATE = §aSimulator erstellt SIMULATOR_EDIT_LOCATION = §7Editiere Positionen SIMULATOR_EDIT_PROPERTIES = §7Editiere Eigenschaften SIMULATOR_EDIT_OTHER = §7Editiere Andere +SIMULATOR_EDIT_GROUP = §7Editiere Gruppe SIMULATOR_WAND_NAME = §eKanonensimulator +SIMULATOR_WAND_NAME_SELECTED = §7Kanonensimulator §8- §e{0} SIMULATOR_WAND_LORE_1 = §eRechtsklick §8- §7Füge eine Position hinzu SIMULATOR_WAND_LORE_2 = §eSneaken §8- §7Freie Bewegung SIMULATOR_WAND_LORE_3 = §eLinksklick §8- §7Starte die Simulation @@ -541,10 +543,11 @@ SIMULATOR_POSITION_ADD = §ePosition setzen SIMULATOR_GUI_TNT_SPAWN_NAME = §eTNT SIMULATOR_GUI_TNT_SPAWN_LORE_1 = §7TNT-Anzahl§8: §e{0} SIMULATOR_GUI_TNT_SPAWN_LORE_2 = §7Tick§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7 -SIMULATOR_GUI_TNT_SPAWN_LORE_4 = §7x§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_5 = §7y§8: §e{0} -SIMULATOR_GUI_TNT_SPAWN_LORE_6 = §7z§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_3 = §7Lebensdauer§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_4 = §7 +SIMULATOR_GUI_TNT_SPAWN_LORE_5 = §7x§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_6 = §7y§8: §e{0} +SIMULATOR_GUI_TNT_SPAWN_LORE_7 = §7z§8: §e{0} SIMULATOR_GUI_NAME = Kanonensimulator SIMULATOR_GUI_DELETE = §cTNT löschen SIMULATOR_GUI_START = §eStarten @@ -573,6 +576,7 @@ SIMULATOR_TNT_SPAWN_POSITION_Z = §7z-Position §8- §e{0} SIMULATOR_TNT_SPAWN_ACTIVATED_WITH = §7Gezündet durch §8- §e{0} SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR = Comparator SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER = Repeater +SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER = Observer SIMULATOR_TNT_SPAWN_ACTIVATED_UNKNOWN = Unbekannt SIMULATOR_TNT_SPAWN_MATERIAL = §eMaterial SIMULATOR_TNT_SPAWN_MATERIAL_LORE_1 = §7Jetziges Material§8: §e{0} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/OrderUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/OrderUtils.java index b4ccfc76..2c377cea 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/OrderUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/OrderUtils.java @@ -35,10 +35,10 @@ public class OrderUtils { private final List activationOrder = new ArrayList<>(); private final Map nameMap = new HashMap<>(); - private final Map reverseActivationOrderLookupTable = new HashMap<>(); static { add(Material.REPEATER, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_REPEATER"); + add(Material.OBSERVER, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_OBSERVER"); add(Material.COMPARATOR, "SIMULATOR_TNT_SPAWN_ACTIVATED_WITH_COMPARATOR"); } @@ -87,7 +87,6 @@ public class OrderUtils { private void add(Material material, String name) { activationOrder.add(material); - reverseActivationOrderLookupTable.put(activationOrder.size() - 1, material); nameMap.put(material, name); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java index 8f885853..2580fc15 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java @@ -35,6 +35,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import yapion.exceptions.YAPIONException; import yapion.hierarchy.types.YAPIONArray; import yapion.hierarchy.types.YAPIONObject; @@ -85,22 +86,18 @@ public class SimulatorStorage implements Enable, Disable { return tntSimulators.get(selection); } - public static void setSimulator(ItemStack itemStack, TNTSimulator simulator) { + public static void setSimulator(Player player, ItemStack itemStack, TNTSimulator simulator) { for (Map.Entry entry : tntSimulators.entrySet()) { if (entry.getValue() == simulator) { ItemUtils.setTag(itemStack, simulatorSelection, entry.getKey()); + ItemMeta itemMeta = itemStack.getItemMeta(); + itemMeta.setDisplayName(BauSystem.MESSAGE.parse("SIMULATOR_WAND_NAME_SELECTED", player, entry.getKey())); + itemStack.setItemMeta(itemMeta); return; } } } - public static void setSimulator(ItemStack itemStack, String name) { - if (!ItemUtils.isItem(itemStack, "simulator")) { - return; - } - ItemUtils.setTag(itemStack, simulatorSelection, name); - } - public static void removeSimulator(ItemStack itemStack) { if (!ItemUtils.isItem(itemStack, "simulator")) { return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSelectionGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSelectionGUI.java index bdb1f6ee..69bf9b82 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSelectionGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/SimulatorSelectionGUI.java @@ -48,7 +48,7 @@ public class SimulatorSelectionGUI { if (current != null) { current.remove(player); } - SimulatorStorage.setSimulator(hand, tntSimulator); + SimulatorStorage.setSimulator(player, hand, tntSimulator); player.getInventory().setItemInMainHand(hand); player.closeInventory(); }); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java index 2016bd67..083fe4a3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTSimulatorGui.java @@ -73,7 +73,7 @@ public class TNTSimulatorGui { otherLore.add(""); otherLore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_DISABLED", player)); } - inv.setItem(51, new SWItem(Material.ANVIL, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_OTHER", player), otherLore, false, clickType -> { + inv.setItem(51, new SWItem(Material.ANVIL, BauSystem.MESSAGE.parse("SIMULATOR_EDIT_GROUP", player), otherLore, false, clickType -> { })); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java index 47da79e7..d390359f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/tnt/TNTElement.java @@ -149,11 +149,12 @@ public class TNTElement implements SimulatorElement { public SWItem menu(Player p) { List lore = new ArrayList<>(); lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_1", p, count)); - lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_2", p, fuseTicks)); - lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_3", p)); - lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_4", p, getPosition().getX())); - lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_5", p, getPosition().getY())); - lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_6", p, getPosition().getZ())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_2", p, getTickOffset())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_3", p, getFuseTicks())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_4", p)); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_5", p, getPosition().getX())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_6", p, getPosition().getY())); + lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_SPAWN_LORE_7", p, getPosition().getZ())); if (disabled) { lore.add(""); lore.add(BauSystem.MESSAGE.parse("SIMULATOR_GUI_TNT_DISABLED", p));