mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-18 14:11:30 +01:00
Fix Deprecations from WorldEdit 7.3.0
This commit is contained in:
parent
da3c81a88d
commit
c29edf7467
@ -266,7 +266,7 @@ public ProtectedRegion getSpawnProtection(World world) {
|
||||
if (radius > 0) {
|
||||
BlockVector3 spawnLoc = BukkitAdapter.asBlockVector(bWorld.getSpawnLocation());
|
||||
return new ProtectedCuboidRegion("__spawn_protection__",
|
||||
spawnLoc.subtract(radius, 0, radius).withY(world.getMinimumPoint().getY()),
|
||||
spawnLoc.subtract(radius, 0, radius).withY(world.getMinimumPoint().y()),
|
||||
spawnLoc.add(radius, 0, radius).withY(world.getMaxY()));
|
||||
}
|
||||
}
|
||||
|
@ -586,8 +586,8 @@ public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
} else if (event.getEntityType() == EntityType.PRIMED_TNT
|
||||
|| event.getEntityType() == EntityType.MINECART_TNT) {
|
||||
} else if (event.getEntityType() == EntityType.TNT
|
||||
|| event.getEntityType() == EntityType.TNT_MINECART) {
|
||||
if (wcfg.blockTNTExplosions) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -95,9 +95,9 @@ private void logEvent(EventType eventType, @Nullable LocalPlayer player, BlockVe
|
||||
stmt.setString(1, eventType.name());
|
||||
stmt.setString(2, worldName);
|
||||
stmt.setString(3, player != null ? player.getName() : "");
|
||||
stmt.setInt(4, pos.getBlockX());
|
||||
stmt.setInt(5, pos.getBlockY());
|
||||
stmt.setInt(6, pos.getBlockZ());
|
||||
stmt.setInt(4, pos.x());
|
||||
stmt.setInt(5, pos.y());
|
||||
stmt.setInt(6, pos.z());
|
||||
stmt.setString(7, item);
|
||||
stmt.setInt(8, (int)(System.currentTimeMillis() / 1000));
|
||||
stmt.setString(9, comment);
|
||||
|
@ -221,7 +221,7 @@ private void log(@Nullable LocalPlayer player, String message, String comment) {
|
||||
* @return The position's coordinates in human-readable form
|
||||
*/
|
||||
private String getCoordinates(BlockVector3 pos) {
|
||||
return "@" + pos.getBlockX() + "," + pos.getBlockY() + "," + pos.getBlockZ();
|
||||
return "@" + pos.x() + "," + pos.y() + "," + pos.z();
|
||||
}
|
||||
|
||||
private void logEvent(BlacklistEvent event, String text, Target target, BlockVector3 pos, String comment) {
|
||||
|
@ -378,7 +378,7 @@ private void appendRegistryFlagValue(TextComponent.Builder builder, RegistryFlag
|
||||
if (currVal == null) {
|
||||
currVal = getInheritedValue(region, flag);
|
||||
}
|
||||
String display = currVal == null ? regName : currVal.getId();
|
||||
String display = currVal == null ? regName : currVal.id();
|
||||
appendValueText(builder, flag, display, null);
|
||||
}
|
||||
|
||||
|
@ -308,8 +308,8 @@ protected static ProtectedRegion checkRegionFromSelection(Actor actor, String id
|
||||
// Detect the type of region from WorldEdit
|
||||
if (selection instanceof Polygonal2DRegion) {
|
||||
Polygonal2DRegion polySel = (Polygonal2DRegion) selection;
|
||||
int minY = polySel.getMinimumPoint().getBlockY();
|
||||
int maxY = polySel.getMaximumPoint().getBlockY();
|
||||
int minY = polySel.getMinimumPoint().y();
|
||||
int maxY = polySel.getMaximumPoint().y();
|
||||
return new ProtectedPolygonalRegion(id, polySel.getPoints(), minY, maxY);
|
||||
} else if (selection instanceof CuboidRegion) {
|
||||
BlockVector3 min = selection.getMinimumPoint();
|
||||
@ -348,7 +348,7 @@ protected static void warnAboutDimensions(Actor sender, ProtectedRegion region)
|
||||
if (region instanceof GlobalProtectedRegion) {
|
||||
return;
|
||||
}
|
||||
int height = region.getMaximumPoint().getBlockY() - region.getMinimumPoint().getBlockY();
|
||||
int height = region.getMaximumPoint().y() - region.getMinimumPoint().y();
|
||||
if (height <= 2) {
|
||||
sender.printDebug("(Warning: The height of the region was " + (height + 1) + " block(s).)");
|
||||
}
|
||||
|
@ -57,6 +57,6 @@ public EntityType unmarshal(@Nullable Object o) {
|
||||
|
||||
@Override
|
||||
public Object marshal(EntityType o) {
|
||||
return o.getId();
|
||||
return o.id();
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,6 @@ public GameMode unmarshal(@Nullable Object o) {
|
||||
|
||||
@Override
|
||||
public Object marshal(GameMode o) {
|
||||
return o.getId();
|
||||
return o.id();
|
||||
}
|
||||
}
|
||||
|
@ -137,9 +137,9 @@ public Object marshal(Location o) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
vec.put("x", position.getX());
|
||||
vec.put("y", position.getY());
|
||||
vec.put("z", position.getZ());
|
||||
vec.put("x", position.x());
|
||||
vec.put("y", position.y());
|
||||
vec.put("z", position.z());
|
||||
vec.put("yaw", o.getYaw());
|
||||
vec.put("pitch", o.getPitch());
|
||||
return vec;
|
||||
|
@ -61,6 +61,6 @@ public T unmarshal(@Nullable Object o) {
|
||||
|
||||
@Override
|
||||
public Object marshal(T o) {
|
||||
return o.getId();
|
||||
return o.id();
|
||||
}
|
||||
}
|
||||
|
@ -82,9 +82,9 @@ public Vector3 unmarshal(Object o) {
|
||||
@Override
|
||||
public Object marshal(Vector3 o) {
|
||||
Map<String, Object> vec = new HashMap<>();
|
||||
vec.put("x", o.getX());
|
||||
vec.put("y", o.getY());
|
||||
vec.put("z", o.getZ());
|
||||
vec.put("x", o.x());
|
||||
vec.put("y", o.y());
|
||||
vec.put("z", o.z());
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,6 @@ public WeatherType unmarshal(@Nullable Object o) {
|
||||
|
||||
@Override
|
||||
public Object marshal(WeatherType o) {
|
||||
return o.getId();
|
||||
return o.id();
|
||||
}
|
||||
}
|
||||
|
@ -93,10 +93,10 @@ private ListeningExecutorService createExecutor() {
|
||||
private ChunkState get(BlockVector2 position, boolean create) {
|
||||
ChunkState state;
|
||||
synchronized (lock) {
|
||||
state = states.get(position.getBlockX(), position.getBlockZ());
|
||||
state = states.get(position.x(), position.z());
|
||||
if (state == null && create) {
|
||||
state = new ChunkState(position);
|
||||
states.put(position.getBlockX(), position.getBlockZ(), state);
|
||||
states.put(position.x(), position.z(), state);
|
||||
executor.submit(new EnumerateRegions(position));
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ private void rebuild() {
|
||||
for (ChunkState state : previousStates.values()) {
|
||||
BlockVector2 position = state.getPosition();
|
||||
positions.add(position);
|
||||
states.put(position.getBlockX(), position.getBlockZ(), new ChunkState(position));
|
||||
states.put(position.x(), position.z(), new ChunkState(position));
|
||||
}
|
||||
|
||||
if (!positions.isEmpty()) {
|
||||
@ -179,9 +179,9 @@ public void biasAll(Collection<BlockVector2> chunkPositions) {
|
||||
public void forget(BlockVector2 chunkPosition) {
|
||||
checkNotNull(chunkPosition);
|
||||
synchronized (lock) {
|
||||
states.remove(chunkPosition.getBlockX(), chunkPosition.getBlockZ());
|
||||
states.remove(chunkPosition.x(), chunkPosition.z());
|
||||
ChunkState state = lastState;
|
||||
if (state != null && state.getPosition().getBlockX() == chunkPosition.getBlockX() && state.getPosition().getBlockZ() == chunkPosition.getBlockZ()) {
|
||||
if (state != null && state.getPosition().x() == chunkPosition.x() && state.getPosition().z() == chunkPosition.z()) {
|
||||
lastState = null;
|
||||
}
|
||||
}
|
||||
@ -238,10 +238,10 @@ public void applyContaining(BlockVector3 position, Predicate<ProtectedRegion> co
|
||||
checkNotNull(consumer);
|
||||
|
||||
ChunkState state = lastState;
|
||||
int chunkX = position.getBlockX() >> 4;
|
||||
int chunkZ = position.getBlockZ() >> 4;
|
||||
int chunkX = position.x() >> 4;
|
||||
int chunkZ = position.z() >> 4;
|
||||
|
||||
if (state == null || state.getPosition().getBlockX() != chunkX || state.getPosition().getBlockZ() != chunkZ) {
|
||||
if (state == null || state.getPosition().x() != chunkX || state.getPosition().z() != chunkZ) {
|
||||
state = get(BlockVector2.at(chunkX, chunkZ), false);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ protected void rebuildIndex() {
|
||||
@Override
|
||||
public void applyContaining(BlockVector3 position, Predicate<ProtectedRegion> consumer) {
|
||||
Set<ProtectedRegion> seen = new HashSet<>();
|
||||
MBR pointMBR = new SimpleMBR(position.getX(), position.getX(), position.getY(), position.getY(), position.getZ(), position.getZ());
|
||||
MBR pointMBR = new SimpleMBR(position.x(), position.x(), position.y(), position.y(), position.z(), position.z());
|
||||
|
||||
for (ProtectedRegion region : tree.find(pointMBR)) {
|
||||
if (region.contains(position) && !seen.contains(region)) {
|
||||
@ -87,7 +87,7 @@ public void applyIntersecting(ProtectedRegion region, Predicate<ProtectedRegion>
|
||||
BlockVector3 max = region.getMaximumPoint().ceil();
|
||||
|
||||
Set<ProtectedRegion> candidates = new HashSet<>();
|
||||
MBR pointMBR = new SimpleMBR(min.getX(), max.getX(), min.getY(), max.getY(), min.getZ(), max.getZ());
|
||||
MBR pointMBR = new SimpleMBR(min.x(), max.x(), min.y(), max.y(), min.z(), max.z());
|
||||
|
||||
for (ProtectedRegion found : tree.find(pointMBR)) {
|
||||
candidates.add(found);
|
||||
|
@ -84,8 +84,8 @@ protected void migrate(RegionDatabase store) throws MigrationException {
|
||||
if (min == 0 && max == 255) return;
|
||||
}
|
||||
for (ProtectedRegion region : regions) {
|
||||
if (region.getMinimumPoint().getBlockY() <= 0
|
||||
&& region.getMaximumPoint().getBlockY() >= 255) {
|
||||
if (region.getMinimumPoint().y() <= 0
|
||||
&& region.getMaximumPoint().y() >= 255) {
|
||||
expand(region, min, max);
|
||||
changed++;
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ public void saveAll(Set<ProtectedRegion> regions) throws StorageException {
|
||||
} else if (region instanceof ProtectedPolygonalRegion) {
|
||||
ProtectedPolygonalRegion poly = (ProtectedPolygonalRegion) region;
|
||||
node.setProperty("type", "poly2d");
|
||||
node.setProperty("min-y", poly.getMinimumPoint().getBlockY());
|
||||
node.setProperty("max-y", poly.getMaximumPoint().getBlockY());
|
||||
node.setProperty("min-y", poly.getMinimumPoint().y());
|
||||
node.setProperty("max-y", poly.getMaximumPoint().y());
|
||||
|
||||
List<Map<String, Object>> points = new ArrayList<>();
|
||||
for (BlockVector2 point : poly.getPoints()) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("x", point.getBlockX());
|
||||
data.put("z", point.getBlockZ());
|
||||
data.put("x", point.x());
|
||||
data.put("z", point.z());
|
||||
points.add(data);
|
||||
}
|
||||
|
||||
|
@ -113,12 +113,12 @@ private void insertCuboids() throws SQLException {
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
|
||||
stmt.setString(1, region.getId());
|
||||
stmt.setInt(2, min.getBlockZ());
|
||||
stmt.setInt(3, min.getBlockY());
|
||||
stmt.setInt(4, min.getBlockX());
|
||||
stmt.setInt(5, max.getBlockZ());
|
||||
stmt.setInt(6, max.getBlockY());
|
||||
stmt.setInt(7, max.getBlockX());
|
||||
stmt.setInt(2, min.z());
|
||||
stmt.setInt(3, min.y());
|
||||
stmt.setInt(4, min.x());
|
||||
stmt.setInt(5, max.z());
|
||||
stmt.setInt(6, max.y());
|
||||
stmt.setInt(7, max.x());
|
||||
stmt.addBatch();
|
||||
}
|
||||
|
||||
@ -141,8 +141,8 @@ private void insertPolygons() throws SQLException {
|
||||
for (List<ProtectedPolygonalRegion> partition : Lists.partition(polygons, StatementBatch.MAX_BATCH_SIZE)) {
|
||||
for (ProtectedPolygonalRegion region : partition) {
|
||||
stmt.setString(1, region.getId());
|
||||
stmt.setInt(2, region.getMaximumPoint().getBlockY());
|
||||
stmt.setInt(3, region.getMinimumPoint().getBlockY());
|
||||
stmt.setInt(2, region.getMaximumPoint().y());
|
||||
stmt.setInt(3, region.getMinimumPoint().y());
|
||||
stmt.addBatch();
|
||||
}
|
||||
|
||||
@ -167,8 +167,8 @@ private void insertPolygonVertices() throws SQLException {
|
||||
for (ProtectedPolygonalRegion region : polygons) {
|
||||
for (BlockVector2 point : region.getPoints()) {
|
||||
stmt.setString(1, region.getId());
|
||||
stmt.setInt(2, point.getBlockZ());
|
||||
stmt.setInt(3, point.getBlockX());
|
||||
stmt.setInt(2, point.z());
|
||||
stmt.setInt(3, point.x());
|
||||
batch.addBatch();
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public boolean isPhysicalArea() {
|
||||
public List<BlockVector2> getPoints() {
|
||||
// This doesn't make sense
|
||||
List<BlockVector2> pts = new ArrayList<>();
|
||||
pts.add(BlockVector2.at(min.getBlockX(), min.getBlockZ()));
|
||||
pts.add(BlockVector2.at(min.x(), min.z()));
|
||||
return pts;
|
||||
}
|
||||
|
||||
|
@ -113,10 +113,10 @@ public boolean isPhysicalArea() {
|
||||
@Override
|
||||
public List<BlockVector2> getPoints() {
|
||||
List<BlockVector2> pts = new ArrayList<>();
|
||||
int x1 = min.getBlockX();
|
||||
int x2 = max.getBlockX();
|
||||
int z1 = min.getBlockZ();
|
||||
int z2 = max.getBlockZ();
|
||||
int x1 = min.x();
|
||||
int x2 = max.x();
|
||||
int z1 = min.z();
|
||||
int z2 = max.z();
|
||||
|
||||
pts.add(BlockVector2.at(x1, z1));
|
||||
pts.add(BlockVector2.at(x2, z1));
|
||||
@ -128,12 +128,12 @@ public List<BlockVector2> getPoints() {
|
||||
|
||||
@Override
|
||||
public boolean contains(BlockVector3 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;
|
||||
final double x = pt.x();
|
||||
final double y = pt.y();
|
||||
final double z = pt.z();
|
||||
return x >= min.x() && x < max.x() + 1
|
||||
&& y >= min.y() && y < max.y() + 1
|
||||
&& z >= min.z() && z < max.z() + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -143,10 +143,10 @@ public RegionType getType() {
|
||||
|
||||
@Override
|
||||
Area toArea() {
|
||||
int x = getMinimumPoint().getBlockX();
|
||||
int z = getMinimumPoint().getBlockZ();
|
||||
int width = getMaximumPoint().getBlockX() - x + 1;
|
||||
int height = getMaximumPoint().getBlockZ() - z + 1;
|
||||
int x = getMinimumPoint().x();
|
||||
int z = getMinimumPoint().z();
|
||||
int width = getMaximumPoint().x() - x + 1;
|
||||
int height = getMaximumPoint().z() - z + 1;
|
||||
return new Area(new Rectangle(x, z, width, height));
|
||||
}
|
||||
|
||||
@ -161,9 +161,9 @@ protected boolean intersects(ProtectedRegion region, Area thisArea) {
|
||||
|
||||
@Override
|
||||
public int volume() {
|
||||
int xLength = max.getBlockX() - min.getBlockX() + 1;
|
||||
int yLength = max.getBlockY() - min.getBlockY() + 1;
|
||||
int zLength = max.getBlockZ() - min.getBlockZ() + 1;
|
||||
int xLength = max.x() - min.x() + 1;
|
||||
int yLength = max.y() - min.y() + 1;
|
||||
int zLength = max.z() - min.z() + 1;
|
||||
|
||||
try {
|
||||
long v = MathUtils.checkedMultiply(xLength, yLength);
|
||||
|
@ -65,8 +65,8 @@ public ProtectedPolygonalRegion(String id, boolean transientRegion, List<BlockVe
|
||||
ImmutableList<BlockVector2> immutablePoints = ImmutableList.copyOf(points);
|
||||
setMinMaxPoints(immutablePoints, minY, maxY);
|
||||
this.points = immutablePoints;
|
||||
this.minY = min.getBlockY();
|
||||
this.maxY = max.getBlockY();
|
||||
this.minY = min.y();
|
||||
this.maxY = max.y();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ private void setMinMaxPoints(List<BlockVector2> points2D, int minY, int maxY) {
|
||||
List<BlockVector3> points = new ArrayList<>();
|
||||
int y = minY;
|
||||
for (BlockVector2 point2D : points2D) {
|
||||
points.add(BlockVector3.at(point2D.getBlockX(), y, point2D.getBlockZ()));
|
||||
points.add(BlockVector3.at(point2D.x(), y, point2D.z()));
|
||||
y = maxY;
|
||||
}
|
||||
setMinMaxPoints(points);
|
||||
@ -102,15 +102,15 @@ public List<BlockVector2> getPoints() {
|
||||
public boolean contains(BlockVector3 position) {
|
||||
checkNotNull(position);
|
||||
|
||||
int targetX = position.getBlockX(); // Width
|
||||
int targetY = position.getBlockY(); // Height
|
||||
int targetZ = position.getBlockZ(); // Depth
|
||||
int targetX = position.x(); // Width
|
||||
int targetY = position.y(); // Height
|
||||
int targetZ = position.z(); // Depth
|
||||
|
||||
if (targetY < minY || targetY > maxY) {
|
||||
return false;
|
||||
}
|
||||
//Quick and dirty check.
|
||||
if (targetX < min.getBlockX() || targetX > max.getBlockX() || targetZ < min.getBlockZ() || targetZ > max.getBlockZ()) {
|
||||
if (targetX < min.x() || targetX > max.x() || targetZ < min.z() || targetZ > max.z()) {
|
||||
return false;
|
||||
}
|
||||
boolean inside = false;
|
||||
@ -122,12 +122,12 @@ public boolean contains(BlockVector3 position) {
|
||||
long crossproduct;
|
||||
int i;
|
||||
|
||||
xOld = points.get(npoints - 1).getBlockX();
|
||||
zOld = points.get(npoints - 1).getBlockZ();
|
||||
xOld = points.get(npoints - 1).x();
|
||||
zOld = points.get(npoints - 1).z();
|
||||
|
||||
for (i = 0; i < npoints; i++) {
|
||||
xNew = points.get(i).getBlockX();
|
||||
zNew = points.get(i).getBlockZ();
|
||||
xNew = points.get(i).x();
|
||||
zNew = points.get(i).z();
|
||||
//Check for corner
|
||||
if (xNew == targetX && zNew == targetZ) {
|
||||
return true;
|
||||
@ -173,8 +173,8 @@ Area toArea() {
|
||||
|
||||
int i = 0;
|
||||
for (BlockVector2 point : points) {
|
||||
xCoords[i] = point.getBlockX();
|
||||
yCoords[i] = point.getBlockZ();
|
||||
xCoords[i] = point.x();
|
||||
yCoords[i] = point.z();
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -92,17 +92,17 @@ public abstract class ProtectedRegion implements ChangeTracked, Comparable<Prote
|
||||
* @param points the points to set with at least one entry
|
||||
*/
|
||||
protected void setMinMaxPoints(List<BlockVector3> points) {
|
||||
int minX = points.get(0).getBlockX();
|
||||
int minY = points.get(0).getBlockY();
|
||||
int minZ = points.get(0).getBlockZ();
|
||||
int minX = points.get(0).x();
|
||||
int minY = points.get(0).y();
|
||||
int minZ = points.get(0).z();
|
||||
int maxX = minX;
|
||||
int maxY = minY;
|
||||
int maxZ = minZ;
|
||||
|
||||
for (BlockVector3 v : points) {
|
||||
int x = v.getBlockX();
|
||||
int y = v.getBlockY();
|
||||
int z = v.getBlockZ();
|
||||
int x = v.x();
|
||||
int y = v.y();
|
||||
int z = v.z();
|
||||
|
||||
if (x < minX) minX = x;
|
||||
if (y < minY) minY = y;
|
||||
@ -514,7 +514,7 @@ public void copyFrom(ProtectedRegion other) {
|
||||
*/
|
||||
public boolean contains(BlockVector2 position) {
|
||||
checkNotNull(position);
|
||||
return contains(BlockVector3.at(position.getBlockX(), min.getBlockY(), position.getBlockZ()));
|
||||
return contains(BlockVector3.at(position.x(), min.y(), position.z()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -607,16 +607,16 @@ protected boolean intersectsBoundingBox(ProtectedRegion region) {
|
||||
BlockVector3 rMaxPoint = region.getMaximumPoint();
|
||||
BlockVector3 min = getMinimumPoint();
|
||||
|
||||
if (rMaxPoint.getBlockX() < min.getBlockX()) return false;
|
||||
if (rMaxPoint.getBlockY() < min.getBlockY()) return false;
|
||||
if (rMaxPoint.getBlockZ() < min.getBlockZ()) return false;
|
||||
if (rMaxPoint.x() < min.x()) return false;
|
||||
if (rMaxPoint.y() < min.y()) return false;
|
||||
if (rMaxPoint.z() < min.z()) return false;
|
||||
|
||||
BlockVector3 rMinPoint = region.getMinimumPoint();
|
||||
BlockVector3 max = getMaximumPoint();
|
||||
|
||||
if (rMinPoint.getBlockX() > max.getBlockX()) return false;
|
||||
if (rMinPoint.getBlockY() > max.getBlockY()) return false;
|
||||
if (rMinPoint.getBlockZ() > max.getBlockZ()) return false;
|
||||
if (rMinPoint.x() > max.x()) return false;
|
||||
if (rMinPoint.y() > max.y()) return false;
|
||||
if (rMinPoint.z() > max.z()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -636,16 +636,16 @@ protected boolean intersectsEdges(ProtectedRegion region) {
|
||||
for (BlockVector2 aPts2 : pts2) {
|
||||
|
||||
Line2D line1 = new Line2D.Double(
|
||||
lastPt1.getBlockX(),
|
||||
lastPt1.getBlockZ(),
|
||||
aPts1.getBlockX(),
|
||||
aPts1.getBlockZ());
|
||||
lastPt1.x(),
|
||||
lastPt1.z(),
|
||||
aPts1.x(),
|
||||
aPts1.z());
|
||||
|
||||
if (line1.intersectsLine(
|
||||
lastPt2.getBlockX(),
|
||||
lastPt2.getBlockZ(),
|
||||
aPts2.getBlockX(),
|
||||
aPts2.getBlockZ())) {
|
||||
lastPt2.x(),
|
||||
lastPt2.z(),
|
||||
aPts2.x(),
|
||||
aPts2.z())) {
|
||||
return true;
|
||||
}
|
||||
lastPt2 = aPts2;
|
||||
|
@ -30,27 +30,21 @@ public int getDimensions() {
|
||||
|
||||
@Override
|
||||
public double getMax(int dimension, ProtectedRegion region) {
|
||||
switch (dimension) {
|
||||
case 0:
|
||||
return region.getMaximumPoint().getBlockX();
|
||||
case 1:
|
||||
return region.getMaximumPoint().getBlockY();
|
||||
case 2:
|
||||
return region.getMaximumPoint().getBlockZ();
|
||||
}
|
||||
return 0;
|
||||
return switch (dimension) {
|
||||
case 0 -> region.getMaximumPoint().x();
|
||||
case 1 -> region.getMaximumPoint().y();
|
||||
case 2 -> region.getMaximumPoint().z();
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMin(int dimension, ProtectedRegion region) {
|
||||
switch (dimension) {
|
||||
case 0:
|
||||
return region.getMinimumPoint().getBlockX();
|
||||
case 1:
|
||||
return region.getMinimumPoint().getBlockY();
|
||||
case 2:
|
||||
return region.getMinimumPoint().getBlockZ();
|
||||
}
|
||||
return 0;
|
||||
return switch (dimension) {
|
||||
case 0 -> region.getMinimumPoint().x();
|
||||
case 1 -> region.getMinimumPoint().y();
|
||||
case 2 -> region.getMinimumPoint().z();
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public static Region convertToRegion(ProtectedRegion region) {
|
||||
}
|
||||
if (region instanceof ProtectedPolygonalRegion) {
|
||||
return new Polygonal2DRegion(null, region.getPoints(),
|
||||
region.getMinimumPoint().getY(), region.getMaximumPoint().getY());
|
||||
region.getMinimumPoint().y(), region.getMaximumPoint().y());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -68,7 +68,7 @@ public static RegionSelector convertToSelector(ProtectedRegion region) {
|
||||
}
|
||||
if (region instanceof ProtectedPolygonalRegion) {
|
||||
return new Polygonal2DRegionSelector(null, region.getPoints(),
|
||||
region.getMinimumPoint().getY(), region.getMaximumPoint().getY());
|
||||
region.getMinimumPoint().y(), region.getMaximumPoint().y());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user