mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-02 13:44:43 +02:00
Refactor / Cleanup / Optimizations
This commit is contained in:
@ -34,6 +34,10 @@ public class RegionWrapper {
|
||||
return ((x >= minX) && (x <= maxX) && (z >= minZ) && (z <= maxZ));
|
||||
}
|
||||
|
||||
public boolean intersects(RegionWrapper other) {
|
||||
return (other.minX <= this.maxX) && (other.maxX >= this.minX) && (other.minY <= this.maxY) && (other.maxY >= this.minY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return minX + 13 * maxX + 23 * minZ + 39 * maxZ;
|
||||
@ -58,4 +62,10 @@ public class RegionWrapper {
|
||||
public String toString() {
|
||||
return minX + "->" + maxX + "," + minZ + "->" + maxZ;
|
||||
}
|
||||
|
||||
public Location[] getCorners(String world) {
|
||||
Location pos1 = new Location(world, minX, minY, minZ);
|
||||
Location pos2 = new Location(world, maxX, maxY, maxZ);
|
||||
return new Location[] { pos1, pos2 };
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user