mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 19:06:41 +00:00
Add /center commmand
This commit is contained in:
@ -35,6 +35,11 @@ public abstract class AbstractRegion implements Region {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getCenter() {
|
||||
return getMinimumPoint().add(getMaximumPoint()).divide(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the iterator.
|
||||
*
|
||||
|
@ -87,6 +87,7 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Vector getCenter() {
|
||||
return center.toVector((maxY + minY) / 2);
|
||||
}
|
||||
|
@ -175,6 +175,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
||||
*
|
||||
* @return center
|
||||
*/
|
||||
@Override
|
||||
public Vector getCenter() {
|
||||
return center;
|
||||
}
|
||||
|
@ -44,6 +44,15 @@ public interface Region extends Iterable<BlockVector>, Cloneable {
|
||||
*/
|
||||
public Vector getMaximumPoint();
|
||||
|
||||
/**
|
||||
* Get the center point of a region.
|
||||
* Note: Coordinates will not be integers
|
||||
* if the corresponding lengths are even.
|
||||
*
|
||||
* @return center point
|
||||
*/
|
||||
public Vector getCenter();
|
||||
|
||||
/**
|
||||
* Get the number of blocks in the region.
|
||||
*
|
||||
|
Reference in New Issue
Block a user