mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-28 18:21:20 +01:00
Fix off-by-one in area calculation.
Even the volume calculation had it correct. Also fix code style in contains.
This commit is contained in:
parent
0f72811bfc
commit
3a332fd87d
@ -125,9 +125,9 @@ public boolean contains(Vector pt) {
|
||||
final double x = pt.getX();
|
||||
final double y = pt.getY();
|
||||
final double z = pt.getZ();
|
||||
return x >= min.getBlockX() && x < max.getBlockX()+1
|
||||
&& y >= min.getBlockY() && y < max.getBlockY()+1
|
||||
&& z >= min.getBlockZ() && z < max.getBlockZ()+1;
|
||||
return x >= min.getBlockX() && x < max.getBlockX() + 1
|
||||
&& y >= min.getBlockY() && y < max.getBlockY() + 1
|
||||
&& z >= min.getBlockZ() && z < max.getBlockZ() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,8 +139,8 @@ public RegionType getType() {
|
||||
Area toArea() {
|
||||
int x = getMinimumPoint().getBlockX();
|
||||
int z = getMinimumPoint().getBlockZ();
|
||||
int width = getMaximumPoint().getBlockX() - x;
|
||||
int height = getMaximumPoint().getBlockZ() - z;
|
||||
int width = getMaximumPoint().getBlockX() - x + 1;
|
||||
int height = getMaximumPoint().getBlockZ() - z + 1;
|
||||
return new Area(new Rectangle(x, z, width, height));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user