Package com.plotsquared.core.plot
Class Plot
java.lang.Object
com.plotsquared.core.plot.Plot
- Direct Known Subclasses:
SinglePlot
The plot class
[IMPORTANT] - Unclaimed plots will not have persistent information. - Any information set/modified in an unclaimed object may not be reflected in other instances - Using the `new` operator will create an unclaimed plot instance - Use the methods from the PlotArea/PS/Location etc to get existing plots
[IMPORTANT] - Unclaimed plots will not have persistent information. - Any information set/modified in an unclaimed object may not be reflected in other instances - Using the `new` operator will create an unclaimed plot instance - Use the methods from the PlotArea/PS/Location etc to get existing plots
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an unowned plot.Plot(@NonNull PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members, HashSet<UUID> denied, String alias, BlockLoc position, Collection<PlotFlag<?,?>> flags, PlotArea area, boolean[] merged, long timestamp, int temp)Constructor for a saved plots (Used by the database manager when plots are fetched)Constructor for a new plot.Constructor for a temporary plot (use -1 for temp)
The database will ignore any queries regarding temporary plots. -
Method Summary
Modifier and TypeMethodDescriptionvoidDenies a player from this plot.voidAdd someone as a trusted user (updates database as well)booleanSets a rating for a user
- If the user has already rated, the following will return falseintReturns true if a previous task was runningvoidaddTrusted(@NonNull UUID uuid)Add someone as a helper (updates database as well)booleancanClaim(@NonNull PlotPlayer<?> player)Check if a plot can be claimed by the provided player.booleanclaim(@NonNull PlotPlayer<?> player, boolean teleport, String schematic)Deprecated, for removal: This API element is subject to removal in a future version.booleanclaim(@NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB)Deprecated, for removal: This API element is subject to removal in a future version.booleanclaim(@NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB, boolean auto)Claim the plotvoidvoidClear the ratings/likes for this plotint[]Count the entities in a plotvoidvoiddeleteMeta(@NonNull String key)Delete the metadata for a key
- metadata is session only - deleting other plugin's metadata may cause issuesbooleanformat(Caption iInfo, PlotPlayer<?> player, boolean full)static @Nullable PlotfromString(@Nullable PlotArea defaultArea, @NonNull String string)Gets a plot from a string e.g.@NonNull StringgetAlias()Gets the plot aliasCollection<PlotFlag<?,?>>getApplicableFlags(boolean ignorePluginFlags)Get flags associated with the plot and the plot area that contains it.Collection<PlotFlag<?,?>>getApplicableFlags(boolean plotOnly, boolean ignorePluginFlags)Get flags associated with the plot.@Nullable PlotAreagetArea()Gets the plot world object for this plot
- The generic PlotArea object can be casted to its respective class for more control (e.g.doubleGets the average rating of the plot.@org.checkerframework.checker.nullness.qual.NonNull double[]If rating categories are enabled, get the average rating by category.
- The index corresponds to the index of the category in the configgetBasePlot(boolean recalculate)The base plot is an arbitrary but specific connected plot.voidRetrieve the biome of the plot.com.sk89q.worldedit.world.biome.BiomeTypeDeprecated.May cause synchronous chunk loadsDeprecated.in favor of getCorners()[0];Returns the bottom location for the plot.voidDeprecated.May cause synchronous chunk loads@Nullable PlotClusterGets the cluster this plot is associated withgetComplexity(Settings.Auto_Clear settings)This will return null if the plot hasn't been analyzedGets a set of plots connected (and including) this plot
- This result is cached globallyLocation[]Deprecated.as merged plots no longer need to be rectangularvoidgetDefaultHome(boolean member, Consumer<Location> result)voidgetDefaultHome(Consumer<Location> result)Gets the default home location for a plot
- Ignores any home location set for that specific plotgetDefaultHomeSynchronous(boolean member)Deprecated.May cause synchronous chunk loadsGets the denied users.intGets the bot loc of a plot (if mega, returns bot loc of that mega plot) - If you would like each plot treated as a small plot usegetBottomAbs()Gets the top loc of a plot (if mega, returns top loc of that mega plot) - If you would like each plot treated as a small plot usegetTopAbs()<T> @NonNull TGet the value associated with the specified flag.<T, V extends PlotFlag<T, ?>>
@NonNull TgetFlag(@NonNull V flag)Get the value associated with the specified flag.@NonNull FlagContainerGet the plot flag containergetFlags()Get an immutable view of all the flags associated with the plot.voidReturn the home location for the plotDeprecated.May cause synchronous chunk loading@NonNull PlotIdgetId()Gets thePlotIdof this plot.com.sk89q.worldedit.regions.CuboidRegionAttempt to find the largest rectangular region in a plot (as plots can form non rectangular shapes)getLikes()@NonNull PlotManagerGets the plot manager object for this plot
- The generic PlotManager object can be casted to its respective class for more control (e.g.Gets the membersboolean[]Gets the merged array.@Nullable ObjectGets the metadata for a key
For persistent metadata use the flag system@Nullable UUIDgetOwner()Get the plot owner of this particular sub-plot.@Nullable UUIDGet the owner of this exact plot, as it is stored in the database.Gets a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots).@NonNull List<PlotPlayer<?>>Efficiently get the players currently inside this plot
- Will return an empty list if no players are in the plot
- Remember, you can cast a PlotPlayer to its respective implementation (BukkitPlayer, SpongePlayer) to obtain the player objectstatic @Nullable PlotReturn a new/cached plot object at a given location.@NonNull PlotCommentContainerGet the plot comment container.static @Nullable PlotgetPlotFromString(@Nullable PlotPlayer<?> player, @Nullable String arg, boolean message)Get the plot from a string.@NonNull PlotModificationManagerGet the plot modification managerGets the set home location or 0,0,0 if no location is set
- Does not take the default home location into accountGets the ratings associated with a plot
- The rating object may contain multiple categories@NonNull Set<com.sk89q.worldedit.regions.CuboidRegion>This will combine each plot into effective rectangular regions
- This result is cached globally
- Useful for handling non rectangular shapesgetRelative(int x, int y)Gets the plot in a relative location
Note: May be null if the partial plot area does not include the relative location@Nullable PlotgetRelative(@NonNull Direction direction)Gets the plot in a relative direction Note: May be null if the partial plot area does not include the relative locationgetRelative(PlotArea area, int x, int y)intGets the number of tracked running tasks for this plot
- Used to track/limit the number of things a player can do on the plot at once@NonNull PlotSettingsGets or create plot settings.voidDeprecated.May cause synchronous chunk loadslongGets the timestamp of when the plot was created (unreliable)
- not accurate if the plot was created before this was implemented
- Milliseconds since the epochgetTop()Deprecated.in favor of getCorners()[1];Returns the top location for the plot.Gets the trusted users.double@Nullable StringGet the name of the world that the plot is ininthashCode()Gets the plot hashcode
Note: The hashcode is unique if:
- Plots are in the same world
- The x,z coordinates are between Short.MIN_VALUE and Short.MAX_VALUEbooleanhasOwner()Checks if the plot has an owner.booleanbooleanChecks if the player is either the owner or on the trusted/added list.booleanReturns true if the plot is not merged, or it is the base plot of multiple merged plots.booleanChecks if the player is not permitted on this plot.booleanisLoaded()booleanisMerged()Checks if this plot is merged in any direction.booleanisMerged(int dir)Gets if the plot is merged in a direction
------- Actual -------
0 = north
1 = east
2 = south
3 = west
----- Artificial -----
4 = north-east
5 = south-east
6 = south-west
7 = north-west
----------booleanCheck if the plot is merged in a given directionbooleanisOnline()Checks if the owner of this Plot is online.booleanChecks if a UUID is a plot owner (merged plots may have multiple owners)booleanisOwnerAbs(@Nullable UUID uuid)Checks if the given UUID is the owner of this specific plotvoidMerge the plot settings
- Used when a plot is mergedvoidmergePlot(Plot lesserPlot, boolean removeRoads, @Nullable QueueCoordinator queue)Merges two plots.booleanMoves the settings for a plot.voidreEnter()Do the plot entry tasks for each player in the plot
- Usually called when the plot state changes (unclaimed/claimed/flag change etc)booleanremoveDenied(UUID uuid)Remove a denied player (use DBFunc as well)
Using the * uuid will remove all usersbooleanremoveFlag(@NonNull PlotFlag<?,?> flag)Remove a flag from this plotbooleanremoveFlag(@NonNull Class<? extends PlotFlag<?,?>> flag)Remove a flag from this plotbooleanremoveMember(UUID uuid)Remove a trusted user (use DBFunc as well)
Using the * uuid will remove all usersintDecrement the number of tracked tasks this plot is running
- Used to track/limit the number of things a player can do on the plot at oncebooleanremoveTrusted(UUID uuid)Remove a helper (use DBFunc as well)
Using the * uuid will remove all usersvoidSets the plot alias.voidAssigns this plot to a plot area.
(Mostly used during startup when worlds are being created)voidSets the denied users for this plot.<V> booleanSets a flag for the plot and stores it in the database.booleanParse the flag value into a flag instance based on the provided flag class, and store it in the database.voidSets the home locationvoidChange the plot IDvoidsetMembers(@NonNull Set<UUID> uuids)Sets the members for this plot.voidsetMerged(boolean[] merged)Sets the raw merge data
- Updates DB
- Does not modify terrain
Gets if the plot is merged in a direction
----------
0 = north
1 = east
2 = south
3 = west
----------
Note: Diagonal merging (4-7) must be done by merging the corresponding plots.voidSets the raw merge data
- Updates DB
- Does not modify terrainvoidSession only plot metadata (session is until the server stops)
For persistent metadata use the flag systemvoidSets the plot owner (and update the database)booleansetOwner(UUID owner, PlotPlayer<?> initiator)Sets the plot owner (and update the database)voidsetOwnerAbs(@Nullable UUID owner)Set the owner of this exact sub-plot.voidsetTrusted(@NonNull Set<UUID> uuids)Sets the trusted users for this plot.Swaps the settings for two plots.voidteleportPlayer(PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer)Teleport a player to a plot and send them the teleport message.voidteleportPlayer(PlotPlayer<?> player, Consumer<Boolean> result)Teleport a player to a plot and send them the teleport message.toString()Gets plot display name.booleanunclaim()Unclaim the plot (does not modify terrain).voidExpands the world border to include this plot if it is beyond the current border.
-
Field Details
-
MAX_HEIGHT
public static final int MAX_HEIGHT- See Also:
- Constant Field Values
-
temp
Deprecated.magicalRepresents whatever the database manager needs it to:
- A value of -1 usually indicates the plot will not be stored in the DB
- A value of 0 usually indicates that the DB manager hasn't set a value
-
-
Constructor Details
-
Plot
Constructor for a new plot. (Only changes after plot.create() will be properly set in the database)- Parameters:
area- the PlotArea where the plot is locatedid- the plot idowner- the plot owner- See Also:
for existing plots
-
Plot
Constructor for an unowned plot. (Only changes after plot.create() will be properly set in the database)- Parameters:
area- the PlotArea where the plot is locatedid- the plot id- See Also:
for existing plots
-
Plot
Constructor for a temporary plot (use -1 for temp)
The database will ignore any queries regarding temporary plots. Please note that some bulk plot management functions may still affect temporary plots (TODO: fix this)- Parameters:
area- the PlotArea where the plot is locatedid- the plot idowner- the owner of the plottemp- Represents whatever the database manager needs it to- See Also:
for existing plots
-
Plot
public Plot(@NonNull PlotId id, UUID owner, HashSet<UUID> trusted, HashSet<UUID> members, HashSet<UUID> denied, String alias, BlockLoc position, Collection<PlotFlag<?,?>> flags, PlotArea area, boolean[] merged, long timestamp, int temp)Constructor for a saved plots (Used by the database manager when plots are fetched)- Parameters:
id- the plot idowner- the plot ownertrusted- the plot trusted playersmembers- the plot added playersdenied- the plot denied playersalias- the plot's aliasposition- plot home positionflags- the plot's flagsarea- the plot's PlotAreamerged- an array giving merged plotstimestamp- when the plot was createdtemp- value representing whatever DBManager needs to to. Do not touch tbh.- See Also:
for existing plots
-
-
Method Details
-
getPlotFromString
public static @Nullable Plot getPlotFromString(@Nullable PlotPlayer<?> player, @Nullable String arg, boolean message)Get the plot from a string.- Parameters:
player- Provides a context for what world to search in. Prefixing the term with 'world_name;' will override this context.arg- The search termmessage- If a message should be sent to the player if a plot cannot be found- Returns:
- The plot if only 1 result is found, or null
-
fromString
Gets a plot from a string e.g. [area];[id]- Parameters:
defaultArea- if no area is specifiedstring- plot id/area + id- Returns:
- New or existing plot object
-
getPlot
Return a new/cached plot object at a given location.- Parameters:
location- the location of the plot- Returns:
- plot at location or null
- See Also:
if a player is expected here.
-
getOwnerAbs
Get the owner of this exact plot, as it is stored in the database.If the plot is a mega-plot, then the method returns the owner of this particular subplot.
Unlike
getOwner()this method does not consider factors such asServerPlotFlagthat could alter the de facto owner of the plot.- Returns:
- The plot owner of this particular (sub-)plot as stored in the database, if one exists. Else, null.
-
setOwnerAbs
Set the owner of this exact sub-plot. This does not update the database.- Parameters:
owner- The new owner of this particular sub-plot.
-
getWorldName
Get the name of the world that the plot is in- Returns:
- World name
-
setMeta
Session only plot metadata (session is until the server stops)
For persistent metadata use the flag system- Parameters:
key- metadata keyvalue- metadata value
-
getMeta
Gets the metadata for a key
For persistent metadata use the flag system- Parameters:
key- metadata key to get value for- Returns:
- Object value
-
deleteMeta
Delete the metadata for a key
- metadata is session only - deleting other plugin's metadata may cause issues- Parameters:
key- key to delete
-
getCluster
Gets the cluster this plot is associated with- Returns:
- the PlotCluster object, or null
-
getPlayersInPlot
Efficiently get the players currently inside this plot
- Will return an empty list if no players are in the plot
- Remember, you can cast a PlotPlayer to its respective implementation (BukkitPlayer, SpongePlayer) to obtain the player object- Returns:
- list of PlotPlayer(s) or an empty list
-
hasOwner
public boolean hasOwner()Checks if the plot has an owner.- Returns:
trueif there is an owner, elsefalse
-
isOwner
Checks if a UUID is a plot owner (merged plots may have multiple owners)- Parameters:
uuid- Player UUID- Returns:
trueif the provided uuid is the owner of the plot, elsefalse
-
isOwnerAbs
Checks if the given UUID is the owner of this specific plot- Parameters:
uuid- Player UUID- Returns:
trueif the provided uuid is the owner of the plot, elsefalse
-
getOwner
Get the plot owner of this particular sub-plot. (Merged plots can have multiple owners) Direct access is discouraged: use getOwners()- Returns:
- Server if ServerPlot flag set, else
getOwnerAbs() - See Also:
getOwnerAbs() to get the owner as stored in the database
-
setOwner
Sets the plot owner (and update the database)- Parameters:
owner- uuid to set as owner
-
getOwners
Gets a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots).This method cannot be used to add or remove owners from a plot.
- Returns:
- Immutable view of plot owners
-
isAdded
Checks if the player is either the owner or on the trusted/added list.- Parameters:
uuid- uuid to check- Returns:
trueif the player is added/trusted or is the owner, elsefalse
-
isDenied
Checks if the player is not permitted on this plot.- Parameters:
uuid- uuid to check- Returns:
falseif the player is allowed to enter the plot, elsetrue
-
getId
Gets thePlotIdof this plot.- Returns:
- the PlotId for this plot
-
setId
Change the plot ID- Parameters:
id- new plot ID
-
getArea
Gets the plot world object for this plot
- The generic PlotArea object can be casted to its respective class for more control (e.g. HybridPlotWorld)- Returns:
- PlotArea
-
setArea
Assigns this plot to a plot area.
(Mostly used during startup when worlds are being created)
Do not use this unless you absolutely know what you are doing.
- Parameters:
area- area to assign to
-
getManager
Gets the plot manager object for this plot
- The generic PlotManager object can be casted to its respective class for more control (e.g. HybridPlotManager)- Returns:
- PlotManager
-
getSettings
Gets or create plot settings.- Returns:
- PlotSettings
-
isBasePlot
public boolean isBasePlot()Returns true if the plot is not merged, or it is the base plot of multiple merged plots.- Returns:
- Boolean
-
getBasePlot
The base plot is an arbitrary but specific connected plot. It is useful for the following:
- Merged plots need to be treated as a single plot for most purposes
- Some data such as home location needs to be associated with the group rather than each plot
- If the plot is not merged it will return itself.
- The result is cached locally- Parameters:
recalculate- whether to recalculate the merged plots to find the origin- Returns:
- base Plot
-
isMerged
public boolean isMerged()Checks if this plot is merged in any direction.- Returns:
trueif this plot is merged, otherwisefalse
-
getTimestamp
public long getTimestamp()Gets the timestamp of when the plot was created (unreliable)
- not accurate if the plot was created before this was implemented
- Milliseconds since the epoch- Returns:
- the creation date of the plot
-
isMerged
public boolean isMerged(int dir)Gets if the plot is merged in a direction
------- Actual -------
0 = north
1 = east
2 = south
3 = west
----- Artificial -----
4 = north-east
5 = south-east
6 = south-west
7 = north-west
----------
Note: A plot that is merged north and east will not be merged northeast if the northeast plot is not part of the same group
- Parameters:
dir- direction to check for merged plot- Returns:
trueif merged in that direction, elsefalse
-
getDenied
Gets the denied users.- Returns:
- a set of denied users
-
setDenied
Sets the denied users for this plot.- Parameters:
uuids- uuids to deny
-
getTrusted
Gets the trusted users.- Returns:
- a set of trusted users
-
setTrusted
Sets the trusted users for this plot.- Parameters:
uuids- uuids to trust
-
getMembers
Gets the members- Returns:
- a set of members
-
setMembers
Sets the members for this plot.- Parameters:
uuids- uuids to set member status for
-
addDenied
Denies a player from this plot. (updates database as well)- Parameters:
uuid- the uuid of the player to deny.
-
addTrusted
Add someone as a helper (updates database as well)- Parameters:
uuid- the uuid of the player to trust
-
addMember
Add someone as a trusted user (updates database as well)- Parameters:
uuid- the uuid of the player to add as a member
-
setOwner
Sets the plot owner (and update the database)- Parameters:
owner- uuid to set as ownerinitiator- player initiating set owner- Returns:
- boolean
-
isLoaded
public boolean isLoaded() -
getComplexity
This will return null if the plot hasn't been analyzed- Parameters:
settings- The set of settings to obtain the analysis of- Returns:
- analysis of plot
-
getFlags
Get an immutable view of all the flags associated with the plot.- Returns:
- Immutable set containing the flags associated with the plot
-
setFlag
Sets a flag for the plot and stores it in the database.- Type Parameters:
V- flag value type- Parameters:
flag- Flag to set- Returns:
- A boolean indicating whether or not the operation succeeded
-
setFlag
Parse the flag value into a flag instance based on the provided flag class, and store it in the database.- Parameters:
flag- Flag typevalue- Flag value- Returns:
- A boolean indicating whether or not the operation succeeded
-
removeFlag
Remove a flag from this plot- Parameters:
flag- the flag to remove- Returns:
- success
-
getApplicableFlags
Get flags associated with the plot.- Parameters:
plotOnly- Whether or not to only consider the plot. If this parameter is set to true, the default values of the owning plot area will not be consideredignorePluginFlags- Whether or not to ignoreinternal flags- Returns:
- Collection containing all the flags that matched the given criteria
-
getApplicableFlags
Get flags associated with the plot and the plot area that contains it.- Parameters:
ignorePluginFlags- Whether or not to ignoreinternal flags- Returns:
- Collection containing all the flags that matched the given criteria
-
removeFlag
Remove a flag from this plot- Parameters:
flag- the flag to remove- Returns:
- success
-
countEntities
public int[] countEntities()Count the entities in a plot- Returns:
- array of entity counts
- See Also:
0 = Entity 1 = Animal 2 = Monster 3 = Mob 4 = Boat 5 = Misc
-
addRunning
public int addRunning()Returns true if a previous task was running- Returns:
- true if a previous task is running
-
removeRunning
public int removeRunning()Decrement the number of tracked tasks this plot is running
- Used to track/limit the number of things a player can do on the plot at once- Returns:
- previous number of tasks (int)
-
getRunning
public int getRunning()Gets the number of tracked running tasks for this plot
- Used to track/limit the number of things a player can do on the plot at once- Returns:
- number of tasks (int)
-
unclaim
public boolean unclaim()Unclaim the plot (does not modify terrain). Changes made to this plot will not be reflected in unclaimed plot objects.- Returns:
- false if the Plot has no owner, otherwise true.
-
getCenter
-
getCenterSynchronous
Deprecated.May cause synchronous chunk loads- Returns:
- Location of center
-
getSideSynchronous
Deprecated.May cause synchronous chunk loads- Returns:
- side where players should teleport to
-
getSide
-
getHomeSynchronous
Deprecated.May cause synchronous chunk loading- Returns:
- the plot home location
-
getHome
Return the home location for the plot- Parameters:
result- consumer to pass location to when found
-
setHome
Sets the home location- Parameters:
location- location to set as home
-
getDefaultHome
Gets the default home location for a plot
- Ignores any home location set for that specific plot- Parameters:
result- consumer to pass location to when found
-
getDefaultHomeSynchronous
Deprecated.May cause synchronous chunk loads- Parameters:
member- if to get the home for plot members- Returns:
- location of home for members or visitors
-
getDefaultHome
-
getVolume
public double getVolume() -
getAverageRating
public double getAverageRating()Gets the average rating of the plot. This is the value displayed in /plot info- Returns:
- average rating as double,
Double.NaNof no ratings exist
-
addRating
Sets a rating for a user
- If the user has already rated, the following will return false- Parameters:
uuid- uuid of raterrating- rating- Returns:
- success
-
clearRatings
public void clearRatings()Clear the ratings/likes for this plot -
getLikes
-
getRatings
Gets the ratings associated with a plot
- The rating object may contain multiple categories- Returns:
- Map of user who rated to the rating
-
hasRatings
public boolean hasRatings() -
claim
@Deprecated(forRemoval=true) public boolean claim(@NonNull PlotPlayer<?> player, boolean teleport, String schematic)Deprecated, for removal: This API element is subject to removal in a future version. -
claim
@Deprecated(forRemoval=true) public boolean claim(@NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB)Deprecated, for removal: This API element is subject to removal in a future version. -
claim
public boolean claim(@NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB, boolean auto)Claim the plot- Parameters:
player- The player to set the owner toteleport- If the player should be teleportedschematic- The schematic name to paste on the plotupdateDB- If the database should be updatedauto- If the plot is being claimed by a /plot auto- Returns:
- success
-
getBiome
Retrieve the biome of the plot.- Parameters:
result- consumer to pass biome to when found
-
getBiomeSynchronous
Deprecated.May cause synchronous chunk loads- Returns:
- biome at center of plot
-
getTopAbs
Returns the top location for the plot.- Returns:
- location of Absolute Top
-
getBottomAbs
Returns the bottom location for the plot.- Returns:
- location of absolute bottom of plot
-
swapData
Swaps the settings for two plots.- Parameters:
plot- the plot to swap data with- Returns:
- Future containing the result
-
moveData
Moves the settings for a plot.- Parameters:
plot- the plot to movewhenDone- task to run when settings have been moved- Returns:
- success or not
-
getExtendedTopAbs
Gets the top loc of a plot (if mega, returns top loc of that mega plot) - If you would like each plot treated as a small plot usegetTopAbs()- Returns:
- Location top of mega plot
-
getExtendedBottomAbs
Gets the bot loc of a plot (if mega, returns bot loc of that mega plot) - If you would like each plot treated as a small plot usegetBottomAbs()- Returns:
- Location bottom of mega plot
-
getCorners
Deprecated.as merged plots no longer need to be rectangularReturns the top and bottom location.
- If the plot is not connected, it will return its own corners
- the returned locations will not necessarily correspond to claimed plots if the connected plots do not form a rectangular shape- Returns:
- new Location[] { bottom, top }
-
getBottom
Deprecated.in favor of getCorners()[0];- Returns:
- bottom corner location
-
getTop
Deprecated.in favor of getCorners()[1];- Returns:
- the top corner of the plot
-
toString
Gets plot display name. -
removeDenied
Remove a denied player (use DBFunc as well)
Using the * uuid will remove all users- Parameters:
uuid- uuid of player to remove from denied list- Returns:
- success or not
-
removeTrusted
Remove a helper (use DBFunc as well)
Using the * uuid will remove all users- Parameters:
uuid- uuid of trusted player to remove- Returns:
- success or not
-
removeMember
Remove a trusted user (use DBFunc as well)
Using the * uuid will remove all users- Parameters:
uuid- uuid of player to remove- Returns:
- success or not
-
equals
-
hashCode
public int hashCode()Gets the plot hashcode
Note: The hashcode is unique if:
- Plots are in the same world
- The x,z coordinates are between Short.MIN_VALUE and Short.MAX_VALUE -
getAlias
Gets the plot alias. - Returns an empty string if no alias is set- Returns:
- The plot alias
-
setAlias
Sets the plot alias.- Parameters:
alias- The alias
-
setMerged
Sets the raw merge data
- Updates DB
- Does not modify terrain- Parameters:
direction- direction to merge the plot invalue- if the plot is merged or not
-
getMerged
public boolean[] getMerged()Gets the merged array.- Returns:
- boolean [ north, east, south, west ]
-
setMerged
public void setMerged(boolean[] merged)Sets the raw merge data
- Updates DB
- Does not modify terrain
Gets if the plot is merged in a direction
----------
0 = north
1 = east
2 = south
3 = west
----------
Note: Diagonal merging (4-7) must be done by merging the corresponding plots.- Parameters:
merged- set the plot's merged plots
-
clearCache
public void clearCache() -
getPosition
Gets the set home location or 0,0,0 if no location is set
- Does not take the default home location into account- Returns:
- home location
-
canClaim
Check if a plot can be claimed by the provided player.- Parameters:
player- the claiming player- Returns:
- if the given player can claim the plot
-
mergeData
Merge the plot settings
- Used when a plot is merged- Parameters:
plot- plot to merge the data from
-
getRelative
Gets the plot in a relative location
Note: May be null if the partial plot area does not include the relative location- Parameters:
x- relative id Xy- relative id Y- Returns:
- Plot
-
getRelative
-
getRelative
Gets the plot in a relative direction Note: May be null if the partial plot area does not include the relative location- Parameters:
direction- Direction- Returns:
- the plot relative to this one
-
getConnectedPlots
Gets a set of plots connected (and including) this plot
- This result is cached globally- Returns:
- a Set of Plots connected to this Plot
-
getRegions
This will combine each plot into effective rectangular regions
- This result is cached globally
- Useful for handling non rectangular shapes- Returns:
- all regions within the plot
-
getLargestRegion
public com.sk89q.worldedit.regions.CuboidRegion getLargestRegion()Attempt to find the largest rectangular region in a plot (as plots can form non rectangular shapes)- Returns:
- the plot's largest CuboidRegion
-
reEnter
public void reEnter()Do the plot entry tasks for each player in the plot
- Usually called when the plot state changes (unclaimed/claimed/flag change etc) -
debug
-
teleportPlayer
Teleport a player to a plot and send them the teleport message.- Parameters:
player- the playerresult- Called with the result of the teleportation
-
teleportPlayer
public void teleportPlayer(PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer)Teleport a player to a plot and send them the teleport message.- Parameters:
player- the playercause- the cause of the teleportresultConsumer- Called with the result of the teleportation
-
isOnline
public boolean isOnline()Checks if the owner of this Plot is online.- Returns:
- true if the owner of the Plot is online
-
getDistanceFromOrigin
public int getDistanceFromOrigin() -
updateWorldBorder
public void updateWorldBorder()Expands the world border to include this plot if it is beyond the current border. -
mergePlot
Merges two plots.
- Assumes plots are directly next to each other
- saves to DB- Parameters:
lesserPlot- the plot to merge into this plot instanceremoveRoads- if roads should be removed during the mergequeue- NullableQueueCoordinator. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.
-
isMerged
Check if the plot is merged in a given direction- Parameters:
direction- Direction- Returns:
trueif the plot is merged in the given direction
-
getFlag
Get the value associated with the specified flag. This will first look at plot specific flag values, then at the containing plot area and its default values and at last, it will look at the default values stored inGlobalFlagContainer.- Type Parameters:
T- the flag value type- Parameters:
flagClass- The flag type (Class)- Returns:
- The flag value
-
getFlag
Get the value associated with the specified flag. This will first look at plot specific flag values, then at the containing plot area and its default values and at last, it will look at the default values stored inGlobalFlagContainer.- Type Parameters:
V- the flag type (Any instance of the flag)T- the flag's value type- Parameters:
flag- The flag type (Any instance of the flag)- Returns:
- The flag value
-
format
-
getAverageRatings
public @org.checkerframework.checker.nullness.qual.NonNull double[] getAverageRatings()If rating categories are enabled, get the average rating by category.
- The index corresponds to the index of the category in the config- Returns:
- Average ratings in each category
- See Also:
Rating categories
-
getFlagContainer
Get the plot flag container- Returns:
- Flag container
-
getPlotCommentContainer
Get the plot comment container. This can be used to manage and access plot comments- Returns:
- Plot comment container
-
getPlotModificationManager
Get the plot modification manager- Returns:
- Plot modification manager
-