From d9385691e40f549126ab260dce68ce2ef0581a77 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 25 Feb 2023 15:16:03 +0100 Subject: [PATCH] Hotfix clear simulator Signed-off-by: yoyosource --- .../steamwar/bausystem/features/simulator/TNTSimulator.java | 4 ++++ .../bausystem/features/simulator/gui/TNTSimulatorGui.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java index fb6a91cd..f9513cd4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulator.java @@ -117,6 +117,10 @@ public class TNTSimulator { return tntSpawns; } + public void clear() { + new ArrayList<>(tntElementList).forEach(this::remove); + } + public void remove(SimulatorElement element) { if (element instanceof TNTElement) { TNTElement tntElement = (TNTElement) element; 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 aed364bc..e813580a 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 @@ -130,7 +130,7 @@ public class TNTSimulatorGui { inv.setItem(51, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("SIMULATOR_GUI_DELETE", player), clickType -> { if (currentTntSimulator != null) { currentTntSimulator.getTntElementList().forEach(SimulatorElement::close); - currentTntSimulator.getTntElementList().clear(); + currentTntSimulator.clear(); player.closeInventory(); } else { TNTSimulator tntSimulator = SimulatorStorage.getSimulator(player);