public abstract class ProtectedRegion extends java.lang.Object implements ChangeTracked, java.lang.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 java.lang.String |
GLOBAL_REGION |
protected com.sk89q.worldedit.math.BlockVector3 |
max |
protected com.sk89q.worldedit.math.BlockVector3 |
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.math.BlockVector2 position)
Check to see if a position is contained within this region.
|
abstract boolean |
contains(com.sk89q.worldedit.math.BlockVector3 pt)
Check to see if a point is inside this region.
|
boolean |
contains(int x,
int y,
int z)
Check to see if a point is inside this region.
|
boolean |
containsAny(java.util.List<com.sk89q.worldedit.math.BlockVector2> 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.
|
<T extends Flag<V>,V> |
getFlag(T flag)
Get a flag's value.
|
java.util.Map<Flag<?>,java.lang.Object> |
getFlags()
Get the map of flags.
|
java.lang.String |
getId()
Gets the name of this region
|
java.util.List<ProtectedRegion> |
getIntersectingRegions(java.util.Collection<ProtectedRegion> regions)
Return a list of regions from the given list of regions that intersect
with this region.
|
com.sk89q.worldedit.math.BlockVector3 |
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.math.BlockVector3 |
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 java.util.List<com.sk89q.worldedit.math.BlockVector2> |
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.
|
int |
hashCode() |
boolean |
hasMembersOrOwners()
Checks whether a region has members or owners.
|
protected boolean |
intersects(ProtectedRegion region,
java.awt.geom.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(java.lang.String playerName)
Deprecated.
Names are deprecated, this will not return players added by UUID (LocalPlayer)
|
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(java.lang.String playerName)
Deprecated.
Names are deprecated, this will not return owners added by UUID (LocalPlayer)
|
abstract boolean |
isPhysicalArea()
Return whether this type of region encompasses physical area.
|
boolean |
isTransient() |
static boolean |
isValidId(java.lang.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(java.util.Map<Flag<?>,java.lang.Object> flags)
Set the map of flags.
|
void |
setMembers(DefaultDomain members)
Set the members domain.
|
protected void |
setMinMaxPoints(java.util.List<com.sk89q.worldedit.math.BlockVector3> 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.
|
java.lang.String |
toString() |
abstract int |
volume()
Get the number of blocks in this region.
|
public static final java.lang.String GLOBAL_REGION
protected com.sk89q.worldedit.math.BlockVector3 min
protected com.sk89q.worldedit.math.BlockVector3 max
protected void setMinMaxPoints(java.util.List<com.sk89q.worldedit.math.BlockVector3> points)
points - the points to set with at least one entrypublic java.lang.String getId()
public abstract boolean isPhysicalArea()
public com.sk89q.worldedit.math.BlockVector3 getMinimumPoint()
public com.sk89q.worldedit.math.BlockVector3 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(java.lang.String playerName)
playerName - player name to checkpublic boolean isMember(LocalPlayer player)
player - player to check@Deprecated public boolean isMember(java.lang.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 java.util.Map<Flag<?>,java.lang.Object> getFlags()
public void setFlags(java.util.Map<Flag<?>,java.lang.Object> flags)
A copy of the map will be used.
flags - the flags to setpublic void copyFrom(ProtectedRegion other)
other - the other regionpublic abstract java.util.List<com.sk89q.worldedit.math.BlockVector2> getPoints()
public abstract int volume()
public abstract boolean contains(com.sk89q.worldedit.math.BlockVector3 pt)
pt - The point to checkpt is in this regionpublic boolean contains(com.sk89q.worldedit.math.BlockVector2 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(java.util.List<com.sk89q.worldedit.math.BlockVector2> positions)
positions - a list of positionspublic abstract RegionType getType()
public java.util.List<ProtectedRegion> getIntersectingRegions(java.util.Collection<ProtectedRegion> regions)
regions - a list of regions to source fromregions that intersect with this regionprotected boolean intersects(ProtectedRegion region, java.awt.geom.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 isTransient()
true if this region should only be kept in memory and not be savedpublic boolean isDirty()
ChangeTrackedisDirty in interface ChangeTrackedtrue if this region is not transient and changes have been made.public void setDirty(boolean dirty)
ChangeTrackedsetDirty in interface ChangeTrackeddirty - a new dirty statepublic int compareTo(ProtectedRegion other)
compareTo in interface java.lang.Comparable<ProtectedRegion>public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic static boolean isValidId(java.lang.String id)
id - the id to check