mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Make regions Cloneable
This commit is contained in:
parent
56a8574129
commit
842c469285
@ -66,4 +66,12 @@ public abstract class AbstractRegion implements Region {
|
||||
expand(change);
|
||||
contract(change);
|
||||
}
|
||||
|
||||
public AbstractRegion clone() {
|
||||
try {
|
||||
return (AbstractRegion) super.clone();
|
||||
} catch (CloneNotSupportedException exc) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -434,4 +434,8 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
||||
public String toString() {
|
||||
return getMinimumPoint() + " - " + getMaximumPoint();
|
||||
}
|
||||
|
||||
public CuboidRegion clone() {
|
||||
return (CuboidRegion) super.clone();
|
||||
}
|
||||
}
|
||||
|
@ -388,4 +388,8 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
public String toString() {
|
||||
return center + " - " + radius;
|
||||
}
|
||||
|
||||
public CylinderRegion clone() {
|
||||
return (CylinderRegion) super.clone();
|
||||
}
|
||||
}
|
||||
|
@ -275,4 +275,8 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
public void extendRadius(Vector minRadius) {
|
||||
setRadius(Vector.getMaximum(minRadius, getRadius()));
|
||||
}
|
||||
|
||||
public EllipsoidRegion clone() {
|
||||
return (EllipsoidRegion) super.clone();
|
||||
}
|
||||
}
|
||||
|
@ -519,4 +519,10 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
|
||||
sb.append(" * (" + minY + " - " + maxY + ")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Polygonal2DRegion clone() {
|
||||
Polygonal2DRegion clone = (Polygonal2DRegion) super.clone();
|
||||
clone.points = new ArrayList<BlockVector2D>(points);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public interface Region extends Iterable<BlockVector> {
|
||||
public interface Region extends Iterable<BlockVector>, Cloneable {
|
||||
/**
|
||||
* Get the lower point of a region.
|
||||
*
|
||||
@ -151,4 +151,6 @@ public interface Region extends Iterable<BlockVector> {
|
||||
* @return
|
||||
*/
|
||||
public void setWorld(LocalWorld world);
|
||||
|
||||
public Region clone();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user