Added native data getter methods to Bukkit selection API.

Dieser Commit ist enthalten in:
sk89q 2011-03-26 19:26:40 -07:00
Ursprung 789abaada9
Commit cd54bb6f09
3 geänderte Dateien mit 32 neuen und 0 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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