diff --git a/BauSystem_12/pom.xml b/BauSystem_12/pom.xml
index 84b59ee..c146055 100644
--- a/BauSystem_12/pom.xml
+++ b/BauSystem_12/pom.xml
@@ -18,6 +18,7 @@
1.0
+ clean verify -U
src
diff --git a/BauSystem_15/pom.xml b/BauSystem_15/pom.xml
index bcebe1e..c646b3b 100644
--- a/BauSystem_15/pom.xml
+++ b/BauSystem_15/pom.xml
@@ -18,6 +18,7 @@
1.0
+ clean verify -U
src
diff --git a/BauSystem_API/pom.xml b/BauSystem_API/pom.xml
index f84e8ff..942f5d2 100644
--- a/BauSystem_API/pom.xml
+++ b/BauSystem_API/pom.xml
@@ -18,6 +18,7 @@
1.0
+ clean verify -U
src
diff --git a/BauSystem_Main/pom.xml b/BauSystem_Main/pom.xml
index 3aa54e7..4d46542 100644
--- a/BauSystem_Main/pom.xml
+++ b/BauSystem_Main/pom.xml
@@ -18,6 +18,7 @@
1.0
+ clean verify -U
src
@@ -79,5 +80,11 @@
system
${main.basedir}/lib/WorldEdit-1.15.jar
+
+ org.projectlombok
+ lombok
+ 1.18.10
+ provided
+
diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
index 13b99d1..02caaf8 100644
--- a/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
+++ b/BauSystem_Main/src/de/steamwar/bausystem/world/Region.java
@@ -21,10 +21,13 @@ package de.steamwar.bausystem.world;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import com.sk89q.worldedit.math.BlockVector3;
import de.steamwar.bausystem.commands.CommandTNT.TNTMode;
import de.steamwar.core.VersionedCallable;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
+import java.awt.*;
+import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.configuration.ConfigurationSection;
@@ -80,9 +83,7 @@ public class Region {
}
private final String name;
- private final int minX;
- private final int minY;
- private final int minZ;
+ private final Point minPoint;
private final Prototype prototype;
private final String optionsLinkedWith; // nullable
private Region linkedRegion = null; // nullable
@@ -95,9 +96,7 @@ public class Region {
private Region(ConfigurationSection config) {
name = config.getName();
- minX = config.getInt("minX");
- minY = config.getInt("minY");
- minZ = config.getInt("minZ");
+ minPoint = new Point(config.getInt("minX"), config.getInt("minY"), config.getInt("minZ"));
prototype = Prototype.prototypes.get(config.getString("prototype"));
optionsLinkedWith = config.getString("optionsLinkedWith", null);
if (!hasTestblock()) tntMode = TNTMode.OFF;
@@ -106,9 +105,7 @@ public class Region {
public Region(String name) {
this.name = name;
- this.minX = 0;
- this.minY = 0;
- this.minZ = 0;
+ this.minPoint = new Point(0, 0, 0);
this.prototype = null;
this.optionsLinkedWith = null;
tntMode = TNTMode.OFF;
@@ -158,6 +155,14 @@ public class Region {
setLinkedRegion(region -> region.fire = fire);
}
+ public Point getMinPoint() {
+ return prototype.getMinPoint(this);
+ }
+
+ public Point getMaxPoint() {
+ return prototype.getMaxPoint(this);
+ }
+
public boolean inRegion(Location l) {
return prototype.inRegion(this, l);
}
@@ -356,22 +361,38 @@ public class Region {
prototypes.put(config.getName(), this);
}
+ public Point getMinPoint(Region region) {
+ return new Point(
+ region.minPoint.getX() + offsetX,
+ region.minPoint.getY() + offsetY,
+ region.minPoint.getZ() + offsetZ
+ );
+ }
+
+ public Point getMaxPoint(Region region) {
+ return new Point(
+ region.minPoint.getX() + offsetX + sizeX,
+ region.minPoint.getY() + offsetY + sizeY,
+ region.minPoint.getZ() + offsetZ + sizeZ
+ );
+ }
+
public boolean inRegion(Region region, Location l) {
- return inRange(l.getX(), region.minX + offsetX, sizeX) &&
- inRange(l.getY(), region.minY + offsetY, sizeY) &&
- inRange(l.getZ(), region.minZ + offsetZ, sizeZ);
+ return inRange(l.getX(), region.minPoint.getX() + offsetX, sizeX) &&
+ inRange(l.getY(), region.minPoint.getY() + offsetY, sizeY) &&
+ inRange(l.getZ(), region.minPoint.getZ() + offsetZ, sizeZ);
}
public boolean inRegionExtension(Region region, Location l) {
- return inRange(l.getX(), region.minX + offsetX - extensionAxisX, sizeX + extensionAxisX * 2) &&
- inRange(l.getY(), region.minY + offsetY, sizeY + extensionPositiveY) &&
- inRange(l.getZ(), region.minZ + offsetZ - extensionNegativeZ, sizeZ + extensionNegativeZ + extensionPositiveZ);
+ return inRange(l.getX(), region.minPoint.getX() + offsetX - extensionAxisX, sizeX + extensionAxisX * 2) &&
+ inRange(l.getY(), region.minPoint.getY() + offsetY, sizeY + extensionPositiveY) &&
+ inRange(l.getZ(), region.minPoint.getZ() + offsetZ - extensionNegativeZ, sizeZ + extensionNegativeZ + extensionPositiveZ);
}
public EditSession reset(Region region, Schematic schem) throws IOException, NoClipboardException {
- int x = region.minX + offsetX + sizeX / 2;
- int y = region.minY + offsetY;
- int z = region.minZ + offsetZ + sizeZ / 2;
+ int x = region.minPoint.getX() + offsetX + sizeX / 2;
+ int y = region.minPoint.getY() + offsetY;
+ int z = region.minPoint.getZ() + offsetZ + sizeZ / 2;
if (schem == null)
return paste(new File(schematic), x, y, z, rotate);
else
@@ -383,9 +404,9 @@ public class Region {
}
public EditSession protect(Region region, Schematic schem) throws IOException, NoClipboardException {
- int x = region.minX + offsetX + sizeX / 2;
- int y = region.minY + testblock.offsetY - 1;
- int z = region.minZ + offsetZ + sizeZ / 2;
+ int x = region.minPoint.getX() + offsetX + sizeX / 2;
+ int y = region.minPoint.getY() + testblock.offsetY - 1;
+ int z = region.minPoint.getZ() + offsetZ + sizeZ / 2;
if (schem == null)
return paste(new File(protectSchematic), x, y, z, rotate);
else
@@ -414,4 +435,33 @@ public class Region {
new VersionedCallable(() -> Region_15.paste(clipboard, x, y, z, rotate), 15));
}
}
+
+ public static class Point {
+
+ final int x;
+ final int y;
+ final int z;
+
+ public Point(int x, int y, int z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public BlockVector3 toBlockVector3() {
+ return BlockVector3.at(this.x, this.y, this.z);
+ }
+
+ public int getX() {
+ return this.x;
+ }
+
+ public int getY() {
+ return this.y;
+ }
+
+ public int getZ() {
+ return this.z;
+ }
+ }
}
diff --git a/pom.xml b/pom.xml
index 4076eca..a57b450 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,7 @@
+ clean verify -U
org.apache.maven.plugins