diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java index 7f8a670f..0918d7c6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java @@ -20,7 +20,6 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; -import de.steamwar.bausystem.features.simulator.AbstractSimulatorEntity; import de.steamwar.bausystem.features.simulator.show.SimulatorEntityShowMode; import de.steamwar.bausystem.features.simulator.tnt.SimulatorElement; import lombok.experimental.UtilityClass; 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 623df321..15f01945 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorStorage.java @@ -72,6 +72,12 @@ public class SimulatorStorage implements Enable, Disable { return tntSimulators.get(name); } + public static TNTSimulator getSimulator(Player player) { + TNTSimulator current = getSimulator(player.getInventory().getItemInMainHand()); + if (current != null) return current; + return getSimulator(player.getInventory().getItemInOffHand()); + } + public static TNTSimulator getSimulator(ItemStack itemStack) { if (itemStack == null) { return null; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java index d34982c7..3a788410 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTElementGUI.java @@ -109,7 +109,7 @@ public class TNTElementGUI { } Runnable editObserver = () -> { - TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand()); + TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player); ChangePosition.show(inv, player, tntSimulator, tntElement, tntElement::getOwnPosition, x -> x - tntElement.getParentPosition().getX(), y -> y - tntElement.getParentPosition().getY(), z -> z - tntElement.getParentPosition().getZ(), () -> editLocation(player, tntElement, back)); @@ -286,7 +286,7 @@ public class TNTElementGUI { } Runnable editObserver = () -> { - TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand()); + TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player); inv.setItem(19, new SWItem(tntElement.getOrder(), BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_ACTIVATED_NAME", player), OrderUtils.orderList(tntElement.getOrder(), player), false, clickType -> { if (clickType.isShiftClick()) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java index 7cfb6754..0b061fd1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/gui/TNTGroupEditGUI.java @@ -60,7 +60,7 @@ public class TNTGroupEditGUI { List lore = Arrays.asList(BauSystem.MESSAGE.parse("SIMULATOR_TNT_SPAWN_LORE", player)); Runnable editObserver = () -> { - TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand()); + TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player); ChangePosition.show(inv, player, tntSimulator, tntGroup, tntGroup::getPosition, UnaryOperator.identity(), UnaryOperator.identity(), UnaryOperator.identity(), () -> open(player, tntGroup, back)); ChangeMaterial.show(inv, player, 14, tntGroup, Material.BARREL, () -> open(player, tntGroup, back)); 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 ac413908..7cb5d381 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 @@ -121,7 +121,7 @@ public class TNTSimulatorGui { currentTntSimulator.getTntElementList().clear(); player.closeInventory(); } else { - TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player.getInventory().getItemInMainHand()); + TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player); tntSimulator.remove(currentTntGroup); } }));