From 85527f70040613df61a4e28fc6264e931c8247b2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 9 Sep 2023 16:32:03 +0200 Subject: [PATCH] Fix show and hide of TNTSimulator Signed-off-by: yoyosource --- .../features/simulator/SimulatorCommand.java | 2 +- .../features/simulator/SimulatorCursor.java | 18 ------------------ .../simulator/TNTSimulatorListener.java | 1 + 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java index 640d0360..5b552fba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java @@ -44,7 +44,7 @@ public class SimulatorCommand extends SWCommand { @Register(description = "SIMULATOR_HELP") public void genericCommand(@Validator Player p) { - SimulatorCursor.hide(p, null); + SimulatorCursor.hide(p); SWUtils.giveItemToPlayer(p, SimulatorStorage.getWand(p)); } 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 ba072bea..dfaa482f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCursor.java @@ -48,9 +48,6 @@ public class SimulatorCursor { if (cursor != null) cursor.close(); - - tntSimulator.show(player); - if (result == null) return; @@ -84,21 +81,6 @@ public class SimulatorCursor { if (cursor == null) return; cursor.close(); - SimulatorStorage.getSimulatorNames().forEach(s -> { - SimulatorStorage.getSimulator(s).hide(player); - }); - } - - public void hide(Player player, TNTSimulator tntSimulator) { - REntityServer cursor = rEntityServerMap.get(player); - - if (cursor != null) - cursor.close(); - - if (tntSimulator != null) { - tntSimulator.hide(player); - } - rEntityServerMap.remove(player); } public static Vector getPos(Player player, RayTraceUtils.RRayTraceResult result) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java index f0e1b996..b61a6176 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java @@ -94,6 +94,7 @@ public class TNTSimulatorListener implements Listener { if (!tntSimulator.getKey().hasPreview(player)) return o; if (!tntSimulator.getKey().getPreviewRecord().isAir(x.get(o), y.get(o), z.get(o))) return o; Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { + SimulatorCursor.hide(player); PlayerMovementWrapper.impl.setPosition(player, o); }, 0L); return null;