From b5b0cbf35e95262a741b92206d1ce25c0c64e94d Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 20 Jan 2021 10:33:18 +0100 Subject: [PATCH 1/2] Fix Region with null testblock --- .../steamwar/bausystem/commands/CommandTestblock.java | 4 ++++ .../src/de/steamwar/bausystem/world/Region.java | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java index 7543c54..ffb1e3a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java @@ -47,6 +47,10 @@ public class CommandTestblock implements CommandExecutor { for(Region region : Region.getRegions()){ if(region.inRegion(player.getLocation())){ + if (!region.hasTestblock()) { + player.sendMessage(BauSystem.PREFIX + "§cRegion ohne Testblock"); + return false; + } try { Schematic schem = null; if(args.length > 0){ diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java index 5bc4449..d066d09 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -88,6 +88,10 @@ public class Region { prototype.reset(this, schem); } + public boolean hasTestblock() { + return prototype.hasTestblock(); + } + public void resetTestblock(Schematic schem) throws IOException, NoClipboardException{ prototype.resetTestblock(this, schem); } @@ -167,7 +171,7 @@ public class Region { paste(schem.load(), x, y, z, rotate); } - public boolean hasProtection(){ + public boolean hasProtection() { return protectSchematic != null; } @@ -181,6 +185,10 @@ public class Region { paste(schem.load(), x, y, z, rotate); } + public boolean hasTestblock() { + return testblock != null; + } + public void resetTestblock(Region region, Schematic schem) throws IOException, NoClipboardException { testblock.reset(region, schem); } From 3d57e563966928e113bec726fa70000c5d580666 Mon Sep 17 00:00:00 2001 From: jojo Date: Wed, 20 Jan 2021 11:05:33 +0100 Subject: [PATCH 2/2] Fix CommandTestblock --- .../de/steamwar/bausystem/commands/CommandTestblock.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java index ffb1e3a..6859231 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java @@ -46,11 +46,7 @@ public class CommandTestblock implements CommandExecutor { } for(Region region : Region.getRegions()){ - if(region.inRegion(player.getLocation())){ - if (!region.hasTestblock()) { - player.sendMessage(BauSystem.PREFIX + "§cRegion ohne Testblock"); - return false; - } + if(region.inRegion(player.getLocation()) && region.hasTestblock()){ try { Schematic schem = null; if(args.length > 0){