mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 02:27:42 +01:00
Fixed ProtectedCuboidRegion->ProtectedCuboidRegion intersection checking
This commit is contained in:
parent
e8c4c9b218
commit
7c1f878610
@ -145,12 +145,15 @@ public List<ProtectedRegion> getIntersectingRegions(List<ProtectedRegion> region
|
||||
|
||||
// Check whether the region is outside the min and max vector
|
||||
if ((rMinPoint.getBlockX() < min.getBlockX() && rMaxPoint.getBlockX() < min.getBlockX())
|
||||
|| (rMinPoint.getBlockX() > max.getBlockX() && rMaxPoint.getBlockX() > max.getBlockX())
|
||||
&& ((rMinPoint.getBlockY() < min.getBlockY() && rMaxPoint.getBlockY() < min.getBlockY())
|
||||
|| (rMinPoint.getBlockY() > max.getBlockY() && rMaxPoint.getBlockY() > max.getBlockY()))
|
||||
&& ((rMinPoint.getBlockZ() < min.getBlockZ() && rMaxPoint.getBlockZ() < min.getBlockZ())
|
||||
|| (rMinPoint.getBlockZ() > max.getBlockZ() && rMaxPoint.getBlockZ() > max.getBlockZ())) ) {
|
||||
//intersectingRegions.add(regions.get(i));
|
||||
|| (rMinPoint.getBlockX() > max.getBlockX() && rMaxPoint.getBlockX() > max.getBlockX())
|
||||
|| ((rMinPoint.getBlockY() < min.getBlockY() && rMaxPoint.getBlockY() < min.getBlockY())
|
||||
|| (rMinPoint.getBlockY() > max.getBlockY() && rMaxPoint.getBlockY() > max.getBlockY()))
|
||||
|| ((rMinPoint.getBlockZ() < min.getBlockZ() && rMaxPoint.getBlockZ() < min.getBlockZ())
|
||||
|| (rMinPoint.getBlockZ() > max.getBlockZ() && rMaxPoint.getBlockZ() > max.getBlockZ())) )
|
||||
continue;
|
||||
|
||||
if (region instanceof ProtectedCuboidRegion) {
|
||||
intersectingRegions.add(regions.get(i));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -181,21 +184,6 @@ public List<ProtectedRegion> getIntersectingRegions(List<ProtectedRegion> region
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (region instanceof ProtectedCuboidRegion) {
|
||||
BlockVector ptcMin = region.getMinimumPoint();
|
||||
BlockVector ptcMax = region.getMaximumPoint();
|
||||
|
||||
if (this.contains(new Vector(ptcMin.getBlockX(), ptcMin.getBlockY(), ptcMin.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMin.getBlockX(), ptcMin.getBlockY(), ptcMax.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMin.getBlockX(), ptcMax.getBlockY(), ptcMax.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMin.getBlockX(), ptcMax.getBlockY(), ptcMin.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMax.getBlockX(), ptcMax.getBlockY(), ptcMax.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMax.getBlockX(), ptcMax.getBlockY(), ptcMin.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMax.getBlockX(), ptcMin.getBlockY(), ptcMin.getBlockZ()))
|
||||
|| this.contains(new Vector(ptcMax.getBlockX(), ptcMin.getBlockY(), ptcMax.getBlockZ())) ) {
|
||||
intersectingRegions.add(regions.get(i));
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@ -13,7 +12,6 @@
|
||||
public class RegionIntersectTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testCuboidGetIntersectingRegions() {
|
||||
ProtectedRegion region = new ProtectedCuboidRegion("square",
|
||||
new BlockVector(100, 40, 0), new BlockVector(140, 128, 40));
|
||||
|
Loading…
Reference in New Issue
Block a user