diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java index 7543c54..6859231 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java @@ -46,7 +46,7 @@ public class CommandTestblock implements CommandExecutor { } for(Region region : Region.getRegions()){ - if(region.inRegion(player.getLocation())){ + if(region.inRegion(player.getLocation()) && region.hasTestblock()){ 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 6f7ec11..82e9f96 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java @@ -101,6 +101,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); } @@ -114,7 +118,6 @@ public class Region { } public static class Prototype{ - private static final String SECTION_PATH = "/home/minecraft/backbone/server/UserBau/"; private static final Map prototypes = new HashMap<>(); private final int sizeX; @@ -165,7 +168,7 @@ public class Region { } public void fastreset(Region region){ - File file = new File(SECTION_PATH + schematic); + File file = new File(schematic); int x = region.minX + offsetX + sizeX/2; int y = region.minY + offsetY; int z = region.minZ + offsetZ + sizeZ/2; @@ -184,12 +187,12 @@ public class Region { int y = region.minY + offsetY; int z = region.minZ + offsetZ + sizeZ / 2; if(schem == null) - paste(new File(SECTION_PATH + schematic), x, y, z, rotate); + paste(new File(schematic), x, y, z, rotate); else paste(schem.load(), x, y, z, rotate); } - public boolean hasProtection(){ + public boolean hasProtection() { return protectSchematic != null; } @@ -198,11 +201,15 @@ public class Region { int y = region.minY + testblock.offsetY - 1; int z = region.minZ + offsetZ + sizeZ / 2; if(schem == null) - paste(new File(SECTION_PATH + protectSchematic), x, y, z, rotate); + paste(new File(protectSchematic), x, y, z, rotate); else 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); }