mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-27 05:00:08 +08:00
Added native data getter methods to Bukkit selection API.
This commit is contained in:
parent
789abaada9
commit
cd54bb6f09
@ -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 Polygonal2DSelection(World world, Polygonal2DRegion region) {
|
||||
this.world = world;
|
||||
this.poly2d = region;
|
||||
}
|
||||
|
||||
public List<BlockVector2D> getNativePoints() {
|
||||
return poly2d.getPoints();
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
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 Location getMinimumPoint() {
|
||||
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;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user