Add Region.hasType
Add Region.inRegion
Dieser Commit ist enthalten in:
Ursprung
77a62a8063
Commit
1f3dbbb1ec
@ -95,8 +95,37 @@ public class Region {
|
||||
}
|
||||
|
||||
public boolean inRegion(Location location, RegionType regionType, RegionExtensionType regionExtensionType) {
|
||||
// TODO: implement inRegion
|
||||
return false;
|
||||
switch (regionType) {
|
||||
case BUILD:
|
||||
Point minBPoint = regionExtensionType == RegionExtensionType.EXTENSION ? minPointBuildExtension : minPointBuild;
|
||||
Point maxBPoint = regionExtensionType == RegionExtensionType.EXTENSION ? maxPointBuildExtension : maxPointBuild;
|
||||
return inRegion(location, minBPoint, maxBPoint);
|
||||
case TESTBLOCK:
|
||||
Point minTBPoint = regionExtensionType == RegionExtensionType.EXTENSION ? minPointTestblockExtension : minPointTestblock;
|
||||
Point maxTBPoint = regionExtensionType == RegionExtensionType.EXTENSION ? maxPointTestblockExtension : maxPointTestblock;
|
||||
return inRegion(location, minTBPoint, maxTBPoint);
|
||||
default:
|
||||
case NORMAL:
|
||||
return inRegion(location, minPoint, maxPoint);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean inRegion(Location location, Point minPoint, Point maxPoint) {
|
||||
return location.getBlockX() >= minPoint.getX() && location.getBlockX() < maxPoint.getX() &&
|
||||
location.getBlockY() >= minPoint.getY() && location.getBlockY() < maxPoint.getY() &&
|
||||
location.getBlockZ() >= minPoint.getZ() && location.getBlockZ() < maxPoint.getZ();
|
||||
}
|
||||
|
||||
public boolean hasType(RegionType regionType) {
|
||||
switch (regionType) {
|
||||
case BUILD:
|
||||
return prototype != null && prototype.getBuild() != null;
|
||||
case TESTBLOCK:
|
||||
return prototype != null && prototype.getTestblock() != null;
|
||||
default:
|
||||
case NORMAL:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren