From 91960f501b7ac1a3bbfd4461e82980016f3fc042 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 17 Sep 2023 16:14:52 +0200 Subject: [PATCH] Fix LoaderRecorder messages on BlockBreakEvent Signed-off-by: yoyosource --- .../bausystem/features/loader/LoaderRecorder.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java index e179d6e4..31d1d302 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/loader/LoaderRecorder.java @@ -90,10 +90,8 @@ public class LoaderRecorder implements Listener { @EventHandler public void onBlockBreak(BlockBreakEvent event) { if (event.getPlayer() != player) return; - if (event.getBlock().getType() != Material.TNT) { - event.setCancelled(true); - } + boolean removedOne = false; for (int i = 0; i < loaderElementList.size(); i++) { LoaderElement element = loaderElementList.get(i); if (!(element instanceof LoaderInteractionElement)) continue; @@ -103,11 +101,17 @@ public class LoaderRecorder implements Listener { if (i > 0) { loaderElementList.remove(i - 1); } + removedOne = true; break; } } - SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("LOADER_MESSAGE_UNINTERACT", player)); + if (removedOne) { + if (event.getBlock().getType() != Material.TNT) { + event.setCancelled(true); + } + SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("LOADER_MESSAGE_UNINTERACT", player)); + } } @EventHandler