mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-17 02:34:04 +00:00
More deprecation removal
This commit is contained in:
@@ -287,7 +287,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public Set<Vector2D> getChunks() {
|
||||
Set<Vector2D> chunks = new HashSet<Vector2D>();
|
||||
Set<Vector2D> chunks = new HashSet<>();
|
||||
|
||||
Vector min = getMinimumPoint();
|
||||
Vector max = getMaximumPoint();
|
||||
@@ -303,7 +303,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public Set<Vector> getChunkCubes() {
|
||||
Set<Vector> chunks = new HashSet<Vector>();
|
||||
Set<Vector> chunks = new HashSet<>();
|
||||
|
||||
Vector min = getMinimumPoint();
|
||||
Vector max = getMaximumPoint();
|
||||
@@ -372,38 +372,33 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public Iterable<Vector2D> asFlatRegion() {
|
||||
return new Iterable<Vector2D>() {
|
||||
return () -> new Iterator<Vector2D>() {
|
||||
private Vector min = getMinimumPoint();
|
||||
private Vector max = getMaximumPoint();
|
||||
private int nextX = min.getBlockX();
|
||||
private int nextZ = min.getBlockZ();
|
||||
|
||||
@Override
|
||||
public Iterator<Vector2D> iterator() {
|
||||
return new Iterator<Vector2D>() {
|
||||
private Vector min = getMinimumPoint();
|
||||
private Vector max = getMaximumPoint();
|
||||
private int nextX = min.getBlockX();
|
||||
private int nextZ = min.getBlockZ();
|
||||
public boolean hasNext() {
|
||||
return (nextX != Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return (nextX != Integer.MIN_VALUE);
|
||||
@Override
|
||||
public Vector2D next() {
|
||||
if (!hasNext()) throw new java.util.NoSuchElementException();
|
||||
Vector2D answer = new Vector2D(nextX, nextZ);
|
||||
if (++nextX > max.getBlockX()) {
|
||||
nextX = min.getBlockX();
|
||||
if (++nextZ > max.getBlockZ()) {
|
||||
nextX = Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2D next() {
|
||||
if (!hasNext()) throw new java.util.NoSuchElementException();
|
||||
Vector2D answer = new Vector2D(nextX, nextZ);
|
||||
if (++nextX > max.getBlockX()) {
|
||||
nextX = min.getBlockX();
|
||||
if (++nextZ > max.getBlockZ()) {
|
||||
nextX = Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@@ -331,12 +331,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public Iterable<Vector2D> asFlatRegion() {
|
||||
return new Iterable<Vector2D>() {
|
||||
@Override
|
||||
public Iterator<Vector2D> iterator() {
|
||||
return new FlatRegionIterator(CylinderRegion.this);
|
||||
}
|
||||
};
|
||||
return () -> new FlatRegionIterator(CylinderRegion.this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -178,7 +178,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
|
||||
@Override
|
||||
public Set<Vector2D> getChunks() {
|
||||
final Set<Vector2D> chunks = new HashSet<Vector2D>();
|
||||
final Set<Vector2D> chunks = new HashSet<>();
|
||||
|
||||
final Vector min = getMinimumPoint();
|
||||
final Vector max = getMaximumPoint();
|
||||
|
@@ -71,7 +71,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
*/
|
||||
public Polygonal2DRegion(World world, List<BlockVector2D> points, int minY, int maxY) {
|
||||
super(world);
|
||||
this.points = new ArrayList<BlockVector2D>(points);
|
||||
this.points = new ArrayList<>(points);
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
hasY = true;
|
||||
@@ -409,12 +409,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
|
||||
@Override
|
||||
public Iterable<Vector2D> asFlatRegion() {
|
||||
return new Iterable<Vector2D>() {
|
||||
@Override
|
||||
public Iterator<Vector2D> iterator() {
|
||||
return new FlatRegionIterator(Polygonal2DRegion.this);
|
||||
}
|
||||
};
|
||||
return () -> new FlatRegionIterator(Polygonal2DRegion.this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,7 +435,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
@Override
|
||||
public Polygonal2DRegion clone() {
|
||||
Polygonal2DRegion clone = (Polygonal2DRegion) super.clone();
|
||||
clone.points = new ArrayList<BlockVector2D>(points);
|
||||
clone.points = new ArrayList<>(points);
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ import java.util.List;
|
||||
*/
|
||||
public class RegionIntersection extends AbstractRegion {
|
||||
|
||||
private final List<Region> regions = new ArrayList<Region>();
|
||||
private final List<Region> regions = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Create a new instance with the included list of regions.
|
||||
|
@@ -154,7 +154,7 @@ public class TransformRegion extends AbstractRegion {
|
||||
@Override
|
||||
public List<BlockVector2D> polygonize(int maxPoints) {
|
||||
List<BlockVector2D> origPoints = region.polygonize(maxPoints);
|
||||
List<BlockVector2D> transformedPoints = new ArrayList<BlockVector2D>();
|
||||
List<BlockVector2D> transformedPoints = new ArrayList<>();
|
||||
for (BlockVector2D vector : origPoints) {
|
||||
transformedPoints.add(transform.apply(vector.toVector(0)).toVector2D().toBlockVector2D());
|
||||
}
|
||||
|
@@ -19,7 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
@@ -36,14 +37,14 @@ import com.sk89q.worldedit.regions.polyhedron.Triangle;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Creates a {@code ConvexPolyhedralRegion} from a user's selections.
|
||||
@@ -96,7 +97,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
||||
|
||||
region = new ConvexPolyhedralRegion(oldRegion.getWorld());
|
||||
|
||||
for (final BlockVector2D pt : new ArrayList<BlockVector2D>(oldRegion.polygonize(Integer.MAX_VALUE))) {
|
||||
for (final BlockVector2D pt : new ArrayList<>(oldRegion.polygonize(Integer.MAX_VALUE))) {
|
||||
region.addVertex(pt.toVector(minY));
|
||||
region.addVertex(pt.toVector(maxY));
|
||||
}
|
||||
@@ -183,7 +184,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
||||
|
||||
@Override
|
||||
public List<String> getInformationLines() {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
List<String> ret = new ArrayList<>();
|
||||
|
||||
ret.add("Vertices: "+region.getVertices().size());
|
||||
ret.add("Triangles: "+region.getTriangles().size());
|
||||
@@ -239,7 +240,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion
|
||||
Collection<Vector> vertices = region.getVertices();
|
||||
Collection<Triangle> triangles = region.getTriangles();
|
||||
|
||||
Map<Vector, Integer> vertexIds = new HashMap<Vector, Integer>(vertices.size());
|
||||
Map<Vector, Integer> vertexIds = new HashMap<>(vertices.size());
|
||||
int lastVertexId = -1;
|
||||
for (Vector vertex : vertices) {
|
||||
vertexIds.put(vertex, ++lastVertexId);
|
||||
|
@@ -234,7 +234,7 @@ public class CuboidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public List<String> getInformationLines() {
|
||||
final List<String> lines = new ArrayList<String>();
|
||||
final List<String> lines = new ArrayList<>();
|
||||
|
||||
if (position1 != null) {
|
||||
lines.add("Position 1: " + position1);
|
||||
|
@@ -225,7 +225,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public List<String> getInformationLines() {
|
||||
final List<String> lines = new ArrayList<String>();
|
||||
final List<String> lines = new ArrayList<>();
|
||||
|
||||
if (!region.getCenter().equals(Vector.ZERO)) {
|
||||
lines.add("Center: " + region.getCenter());
|
||||
|
@@ -201,7 +201,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public List<String> getInformationLines() {
|
||||
final List<String> lines = new ArrayList<String>();
|
||||
final List<String> lines = new ArrayList<>();
|
||||
|
||||
final Vector center = region.getCenter();
|
||||
if (center.lengthSq() > 0) {
|
||||
|
@@ -19,8 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.sk89q.worldedit.*;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.internal.cui.CUIRegion;
|
||||
import com.sk89q.worldedit.internal.cui.SelectionMinMaxEvent;
|
||||
@@ -32,11 +37,11 @@ import com.sk89q.worldedit.regions.RegionSelector;
|
||||
import com.sk89q.worldedit.regions.selector.limit.SelectorLimits;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Creates a {@code Polygonal2DRegion} from a user's selections.
|
||||
|
@@ -57,9 +57,7 @@ public enum RegionSelectorType {
|
||||
public RegionSelector createSelector() {
|
||||
try {
|
||||
return getSelectorClass().newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException("Could not create selector", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
throw new RuntimeException("Could not create selector", e);
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector.limit;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* No limits at all.
|
||||
@@ -33,12 +33,12 @@ public class PermissiveSelectorLimits implements SelectorLimits {
|
||||
|
||||
@Override
|
||||
public Optional<Integer> getPolygonVertexLimit() {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Integer> getPolyhedronVertexLimit() {
|
||||
return Optional.absent();
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldedit.regions.selector.limit;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Defines limits for selections.
|
||||
|
@@ -48,32 +48,32 @@ public class WorldEditExpressionEnvironment implements ExpressionEnvironment {
|
||||
|
||||
@Override
|
||||
public int getBlockType(double x, double y, double z) {
|
||||
return editSession.getBlockType(toWorld(x, y, z));
|
||||
return editSession.getLazyBlock(toWorld(x, y, z)).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockData(double x, double y, double z) {
|
||||
return editSession.getBlockData(toWorld(x, y, z));
|
||||
return editSession.getLazyBlock(new Vector(x, y, z)).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTypeAbs(double x, double y, double z) {
|
||||
return editSession.getBlockType(new Vector(x, y, z));
|
||||
return editSession.getLazyBlock(new Vector(x, y, z)).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockDataAbs(double x, double y, double z) {
|
||||
return editSession.getBlockData(new Vector(x, y, z));
|
||||
return editSession.getLazyBlock(new Vector(x, y, z)).getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTypeRel(double x, double y, double z) {
|
||||
return editSession.getBlockType(toWorldRel(x, y, z));
|
||||
return editSession.getLazyBlock(toWorldRel(x, y, z)).getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockDataRel(double x, double y, double z) {
|
||||
return editSession.getBlockData(toWorldRel(x, y, z));
|
||||
return editSession.getLazyBlock(new Vector(x, y, z)).getData();
|
||||
}
|
||||
|
||||
public void setCurrentBlock(Vector current) {
|
||||
|
Reference in New Issue
Block a user