mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Cleanup
This commit is contained in:
@ -29,26 +29,26 @@ import com.sk89q.worldedit.regions.*;
|
||||
public class CuboidSelection extends RegionSelection {
|
||||
|
||||
protected CuboidRegion cuboid;
|
||||
|
||||
public CuboidSelection(World world, Location pt1, Location pt2) {
|
||||
|
||||
public CuboidSelection(World world, Location pt1, Location pt2) {
|
||||
this(world, BukkitUtil.toVector(pt1), BukkitUtil.toVector(pt2));
|
||||
}
|
||||
|
||||
public CuboidSelection(World world, Vector pt1, Vector pt2) {
|
||||
|
||||
public CuboidSelection(World world, Vector pt1, Vector pt2) {
|
||||
super(world);
|
||||
|
||||
if (pt1 == null) {
|
||||
throw new IllegalArgumentException("Null point 1 not permitted");
|
||||
}
|
||||
|
||||
|
||||
if (pt2 == null) {
|
||||
throw new IllegalArgumentException("Null point 2 not permitted");
|
||||
}
|
||||
|
||||
|
||||
CuboidRegionSelector sel = new CuboidRegionSelector();
|
||||
sel.selectPrimary(pt1);
|
||||
sel.selectSecondary(pt2);
|
||||
|
||||
|
||||
try {
|
||||
cuboid = sel.getRegion();
|
||||
} catch (IncompleteRegionException e) {
|
||||
@ -58,7 +58,7 @@ public class CuboidSelection extends RegionSelection {
|
||||
setRegionSelector(sel);
|
||||
setRegion(cuboid);
|
||||
}
|
||||
|
||||
|
||||
public CuboidSelection(World world, RegionSelector sel, CuboidRegion region) {
|
||||
super(world, sel, region);
|
||||
this.cuboid = region;
|
||||
|
@ -28,13 +28,13 @@ import com.sk89q.worldedit.regions.*;
|
||||
public class Polygonal2DSelection extends RegionSelection {
|
||||
|
||||
protected Polygonal2DRegion poly2d;
|
||||
|
||||
|
||||
public Polygonal2DSelection(World world, RegionSelector sel, Polygonal2DRegion region) {
|
||||
super(world, sel, region);
|
||||
this.poly2d = region;
|
||||
}
|
||||
|
||||
public Polygonal2DSelection(World world, List<BlockVector2D> points, int minY, int maxY) {
|
||||
|
||||
public Polygonal2DSelection(World world, List<BlockVector2D> points, int minY, int maxY) {
|
||||
super(world);
|
||||
|
||||
minY = Math.min(Math.max(0, minY), 127);
|
||||
@ -48,7 +48,7 @@ public class Polygonal2DSelection extends RegionSelection {
|
||||
setRegionSelector(sel);
|
||||
setRegion(poly2d);
|
||||
}
|
||||
|
||||
|
||||
public List<BlockVector2D> getNativePoints() {
|
||||
return Collections.unmodifiableList(poly2d.getPoints());
|
||||
}
|
||||
|
@ -32,29 +32,29 @@ public abstract class RegionSelection implements Selection {
|
||||
private World world;
|
||||
private RegionSelector selector;
|
||||
private Region region;
|
||||
|
||||
|
||||
public RegionSelection(World world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
|
||||
public RegionSelection(World world, RegionSelector selector, Region region) {
|
||||
this.world = world;
|
||||
this.region = region;
|
||||
this.selector = selector;
|
||||
}
|
||||
|
||||
|
||||
protected Region getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
protected void setRegion(Region region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
|
||||
public RegionSelector getRegionSelector() {
|
||||
return selector;
|
||||
}
|
||||
|
||||
|
||||
protected void setRegionSelector(RegionSelector selector) {
|
||||
this.selector = selector;
|
||||
}
|
||||
@ -99,7 +99,7 @@ public abstract class RegionSelection implements Selection {
|
||||
if (!pt.getWorld().equals(world)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return region.contains(toVector(pt));
|
||||
}
|
||||
|
||||
|
@ -31,70 +31,70 @@ public interface Selection {
|
||||
* @return min. point
|
||||
*/
|
||||
public Location getMinimumPoint();
|
||||
|
||||
|
||||
/**
|
||||
* Get the lower point of a region.
|
||||
*
|
||||
* @return min. point
|
||||
*/
|
||||
public Vector getNativeMinimumPoint();
|
||||
|
||||
|
||||
/**
|
||||
* Get the upper point of a region.
|
||||
*
|
||||
* @return max. point
|
||||
*/
|
||||
public Location getMaximumPoint();
|
||||
|
||||
|
||||
/**
|
||||
* Get the upper point of a region.
|
||||
*
|
||||
* @return max. point
|
||||
*/
|
||||
public Vector getNativeMaximumPoint();
|
||||
|
||||
|
||||
/**
|
||||
* Get the region selector. This is for internal use.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RegionSelector getRegionSelector();
|
||||
|
||||
|
||||
/**
|
||||
* Get the world.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public World getWorld();
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of blocks in the region.
|
||||
*
|
||||
* @return number of blocks
|
||||
*/
|
||||
public int getArea();
|
||||
|
||||
|
||||
/**
|
||||
* Get X-size.
|
||||
*
|
||||
* @return width
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
|
||||
/**
|
||||
* Get Y-size.
|
||||
*
|
||||
* @return height
|
||||
*/
|
||||
public int getHeight();
|
||||
|
||||
|
||||
/**
|
||||
* Get Z-size.
|
||||
*
|
||||
* @return length
|
||||
*/
|
||||
public int getLength();
|
||||
|
||||
|
||||
/**
|
||||
* Returns true based on whether the region contains the point,
|
||||
*
|
||||
|
Reference in New Issue
Block a user