Added native data getter methods to Bukkit selection API.

This commit is contained in:
sk89q 2011-03-26 19:26:40 -07:00
parent 789abaada9
commit cd54bb6f09
3 changed files with 32 additions and 0 deletions

View File

@ -19,7 +19,9 @@
package com.sk89q.worldedit.bukkit.selections;
import java.util.List;
import org.bukkit.World;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.regions.*;
public class Polygonal2DSelection extends RegionSelection {
@ -31,4 +33,8 @@ public class Polygonal2DSelection extends RegionSelection {
this.world = world;
this.poly2d = region;
}
public List<BlockVector2D> getNativePoints() {
return poly2d.getPoints();
}
}

View File

@ -23,6 +23,7 @@ import static com.sk89q.worldedit.bukkit.BukkitUtil.toLocation;
import static com.sk89q.worldedit.bukkit.BukkitUtil.toVector;
import org.bukkit.Location;
import org.bukkit.World;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.regions.Region;
public abstract class RegionSelection implements Selection {
@ -40,11 +41,21 @@ public abstract class RegionSelection implements Selection {
return toLocation(world, region.getMinimumPoint());
}
@Override
public Vector getNativeMinimumPoint() {
return region.getMinimumPoint();
}
@Override
public Location getMaximumPoint() {
return toLocation(world, region.getMaximumPoint());
}
@Override
public Vector getNativeMaximumPoint() {
return region.getMaximumPoint();
}
@Override
public World getWorld() {
return world;

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.bukkit.selections;
import org.bukkit.Location;
import org.bukkit.World;
import com.sk89q.worldedit.Vector;
public interface Selection {
/**
@ -30,6 +31,13 @@ public interface Selection {
*/
public Location getMinimumPoint();
/**
* Get the lower point of a region.
*
* @return min. point
*/
public Vector getNativeMinimumPoint();
/**
* Get the upper point of a region.
*
@ -37,6 +45,13 @@ public interface Selection {
*/
public Location getMaximumPoint();
/**
* Get the upper point of a region.
*
* @return max. point
*/
public Vector getNativeMaximumPoint();
/**
* Get the world.
*