public abstract class ProtectedRegion extends Object implements ChangeTracked, Comparable<ProtectedRegion>
Instances can be modified and access from several threads at a time.
| Modifier and Type | Class and Description |
|---|---|
static class |
ProtectedRegion.CircularInheritanceException
Thrown when setting a parent would create a circular inheritance
situation.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
GLOBAL_REGION |
protected com.sk89q.worldedit.BlockVector |
max |
protected com.sk89q.worldedit.BlockVector |
min |
| Modifier and Type | Method and Description |
|---|---|
void |
clearParent()
Clear the parent (set the parent to
null). |
int |
compareTo(ProtectedRegion other) |
boolean |
contains(com.sk89q.worldedit.BlockVector2D position)
Check to see if a position is contained within this region.
|
boolean |
contains(int x,
int y,
int z)
Check to see if a point is inside this region.
|
abstract boolean |
contains(com.sk89q.worldedit.Vector pt)
Check to see if a point is inside this region.
|
boolean |
containsAny(List<com.sk89q.worldedit.BlockVector2D> positions)
Check to see if any of the points are inside this region projected
onto the X-Z plane.
|
void |
copyFrom(ProtectedRegion other)
Copy attributes from another region.
|
boolean |
equals(Object obj) |
<T extends Flag<V>,V> |
getFlag(T flag)
Get a flag's value.
|
Map<Flag<?>,Object> |
getFlags()
Get the map of flags.
|
String |
getId()
Gets the name of this region
|
List<ProtectedRegion> |
getIntersectingRegions(Collection<ProtectedRegion> regions)
Return a list of regions from the given list of regions that intersect
with this region.
|
com.sk89q.worldedit.BlockVector |
getMaximumPoint()
Get a vector containing the highest X, Y, and Z components for the
corner of the axis-aligned bounding box that contains this region.
|
DefaultDomain |
getMembers()
Get the domain that contains the members of this region, which does
not automatically include the owners.
|
com.sk89q.worldedit.BlockVector |
getMinimumPoint()
Get a vector containing the smallest X, Y, and Z components for the
corner of the axis-aligned bounding box that contains this region.
|
DefaultDomain |
getOwners()
Get the domain that contains the owners of this region.
|
ProtectedRegion |
getParent()
Get the parent of the region, if one exists.
|
abstract List<com.sk89q.worldedit.BlockVector2D> |
getPoints()
Get points of the region projected onto the X-Z plane.
|
int |
getPriority()
Get the priority of the region, where higher numbers indicate a higher
priority.
|
abstract RegionType |
getType()
Get the type of region.
|
String |
getTypeName()
Deprecated.
use
getType() |
int |
hashCode() |
boolean |
hasMembersOrOwners()
Checks whether a region has members or owners.
|
protected boolean |
intersects(ProtectedRegion region,
Area thisArea)
Test whether the given region intersects with this area.
|
protected boolean |
intersectsBoundingBox(ProtectedRegion region)
Checks if the bounding box of a region intersects with with the bounding
box of this region.
|
protected boolean |
intersectsEdges(ProtectedRegion region)
Compares all edges of two regions to see if any of them intersect.
|
boolean |
isDirty()
Tests whether changes have been made.
|
boolean |
isMember(LocalPlayer player)
Checks whether a player is a member OR OWNER of the region
or any of its parents.
|
boolean |
isMember(String playerName)
Deprecated.
Names are deprecated
|
boolean |
isMemberOnly(LocalPlayer player)
Checks whether a player is a member of the region or any of its parents.
|
boolean |
isOwner(LocalPlayer player)
Checks whether a player is an owner of region or any of its parents.
|
boolean |
isOwner(String playerName)
Deprecated.
Names are deprecated
|
abstract boolean |
isPhysicalArea()
Return whether this type of region encompasses physical area.
|
static boolean |
isValidId(String id)
Checks to see if the given ID is a valid ID.
|
void |
setDirty(boolean dirty)
Set whether changes have been made.
|
<T extends Flag<V>,V> |
setFlag(T flag,
V val)
Set a flag's value.
|
void |
setFlags(Map<Flag<?>,Object> flags)
Set the map of flags.
|
void |
setMembers(DefaultDomain members)
Set the members domain.
|
protected void |
setMinMaxPoints(List<com.sk89q.worldedit.Vector> points)
Set the minimum and maximum points of the bounding box for a region
|
void |
setOwners(DefaultDomain owners)
Set the owner domain.
|
void |
setParent(ProtectedRegion parent)
Set the parent of this region.
|
void |
setPriority(int priority)
Set the priority of the region, where higher numbers indicate a higher
priority.
|
String |
toString() |
abstract int |
volume()
Get the number of blocks in this region.
|
public static final String GLOBAL_REGION
protected com.sk89q.worldedit.BlockVector min
protected com.sk89q.worldedit.BlockVector max
protected void setMinMaxPoints(List<com.sk89q.worldedit.Vector> points)
points - the points to set with at least one entrypublic String getId()
public abstract boolean isPhysicalArea()
public com.sk89q.worldedit.BlockVector getMinimumPoint()
public com.sk89q.worldedit.BlockVector getMaximumPoint()
public int getPriority()
public void setPriority(int priority)
priority - the priority to set@Nullable public ProtectedRegion getParent()
nullpublic void setParent(@Nullable ProtectedRegion parent) throws ProtectedRegion.CircularInheritanceException
parent - the new parentProtectedRegion.CircularInheritanceException - when circular inheritance is detectedpublic void clearParent()
null).public DefaultDomain getOwners()
public void setOwners(DefaultDomain owners)
owners - the new domainpublic DefaultDomain getMembers()
public void setMembers(DefaultDomain members)
members - the new domainpublic boolean hasMembersOrOwners()
public boolean isOwner(LocalPlayer player)
player - player to check@Deprecated public boolean isOwner(String playerName)
playerName - player name to checkpublic boolean isMember(LocalPlayer player)
player - player to check@Deprecated public boolean isMember(String playerName)
playerName - player name to checkpublic boolean isMemberOnly(LocalPlayer player)
player - player to check@Nullable public <T extends Flag<V>,V> V getFlag(T flag)
T - the flag typeV - the type of the flag's valueflag - the flag to checkpublic <T extends Flag<V>,V> void setFlag(T flag, @Nullable V val)
T - the flag typeV - the type of the flag's valueflag - the flag to checkval - the value to setpublic Map<Flag<?>,Object> getFlags()
public void setFlags(Map<Flag<?>,Object> flags)
A copy of the map will be used.
flags - the flags to setpublic void copyFrom(ProtectedRegion other)
other - the other regionpublic abstract List<com.sk89q.worldedit.BlockVector2D> getPoints()
public abstract int volume()
public abstract boolean contains(com.sk89q.worldedit.Vector pt)
pt - The point to checkpt is in this regionpublic boolean contains(com.sk89q.worldedit.BlockVector2D position)
position - the position to checkposition is in this regionpublic boolean contains(int x,
int y,
int z)
x - the x coordinate to checky - the y coordinate to checkz - the z coordinate to checkpublic boolean containsAny(List<com.sk89q.worldedit.BlockVector2D> positions)
positions - a list of positionspublic abstract RegionType getType()
@Deprecated public final String getTypeName()
getType()public List<ProtectedRegion> getIntersectingRegions(Collection<ProtectedRegion> regions)
regions - a list of regions to source fromregions that intersect with this regionprotected boolean intersects(ProtectedRegion region, Area thisArea)
region - the region to testthisArea - an area object for this regionprotected boolean intersectsBoundingBox(ProtectedRegion region)
region - the region to checkprotected boolean intersectsEdges(ProtectedRegion region)
region - the region to checkpublic boolean isDirty()
ChangeTrackedisDirty in interface ChangeTrackedpublic void setDirty(boolean dirty)
ChangeTrackedsetDirty in interface ChangeTrackeddirty - a new dirty statepublic int compareTo(ProtectedRegion other)
compareTo in interface Comparable<ProtectedRegion>public static boolean isValidId(String id)
id - the id to checkCopyright © 2015. All Rights Reserved.