From d406ed7e66f6ac82c88fd786780429969a89c3c0 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 3 Feb 2021 18:06:30 +0100 Subject: [PATCH] Fix CommandTNT for Region without Testblock --- .../src/de/steamwar/bausystem/commands/CommandTNT.java | 6 +++++- BauSystem_Main/src/de/steamwar/bausystem/world/Region.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTNT.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTNT.java index bc9e866..e86ba40 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTNT.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTNT.java @@ -140,6 +140,10 @@ public class CommandTNT implements CommandExecutor, Listener { private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) { if (requestedMode != null) { + if (!region.hasTestblock() && requestedMode == TNTMode.ONLY_TB) { + requestedMode = TNTMode.ON; + requestedMessage = getEnableMessage(); + } region.setTntMode(requestedMode); RegionToggleCommand.actionBar(region, requestedMessage); return; @@ -151,7 +155,7 @@ public class CommandTNT implements CommandExecutor, Listener { RegionToggleCommand.actionBar(region, getDisableMessage()); break; case OFF: - if (Region.buildAreaEnabled()) { + if (Region.buildAreaEnabled() && region.hasTestblock()) { region.setTntMode(TNTMode.ONLY_TB); RegionToggleCommand.actionBar(region, getTestblockEnableMessage()); } else { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index 590e033..781a0b7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -110,6 +110,7 @@ public class Region { minZ = config.getInt("minZ"); prototype = Prototype.prototypes.get(config.getString("prototype")); optionsLinkedWith = config.getString("optionsLinkedWith", null); + if (!hasTestblock()) tntMode = TNTMode.OFF; regions.add(this); }