Class Plot
- Direct Known Subclasses:
SinglePlot
[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
Modifier and TypeFieldDescriptionstatic final int
Deprecated, for removal: This API element is subject to removal in a future version.int
Deprecated.magical -
Constructor Summary
ConstructorDescriptionConstructor 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 TypeMethodDescriptionvoid
Denies a player from this plot.void
Add someone as a trusted user (updates database as well)boolean
Sets a rating for a user
- If the user has already rated, the following will return falseint
Returns true if a previous task was runningvoid
addTrusted
(@NonNull UUID uuid) Add someone as a helper (updates database as well)boolean
canClaim
(@NonNull PlotPlayer<?> player) Check if a plot can be claimed by the provided player.boolean
claim
(@NonNull PlotPlayer<?> player, boolean teleport, String schematic) Deprecated, for removal: This API element is subject to removal in a future version.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.boolean
claim
(@NonNull PlotPlayer<?> player, boolean teleport, String schematic, boolean updateDB, boolean auto) Claim the plotvoid
void
Clear the ratings/likes for this plotint[]
Count the entities in a plotvoid
void
deleteMeta
(@NonNull String key) Delete the metadata for a key
- metadata is session only - deleting other plugin's metadata may cause issuesboolean
format
(Caption iInfo, PlotPlayer<?> player, boolean full) fromString
(@Nullable PlotArea defaultArea, @NonNull String string) Gets a plot from a string e.g.getAlias()
Gets the plot alias.Collection<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.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.double
Gets 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.void
Retrieve the biome of the plot.Deprecated.May cause synchronous chunk loadsDeprecated.in favor of getCorners()[0];Returns the bottom location for the plot.void
Deprecated.May cause synchronous chunk loadsGets 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 rectangularvoid
getDefaultHome
(boolean member, Consumer<Location> result) void
getDefaultHome
(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.int
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()
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 T
Get the value associated with the specified flag.Get the value associated with the specified flag.Get the plot flag containergetFlags()
Get an immutable view of all the flags associated with the plot.void
Return the home location for the plotDeprecated.May cause synchronous chunk loadinggetId()
Gets thePlotId
of this plot.Attempt to find the largest rectangular region in a plot (as plots can form non rectangular shapes)getLikes()
Gets 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.Gets the metadata for a key
For persistent metadata use the flag systemgetOwner()
Get the plot owner of this particular sub-plot.Get 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 objectReturn a new/cached plot object at a given location.Get the plot comment container.getPlotFromString
(@Nullable PlotPlayer<?> player, @Nullable String arg, boolean message) Get the plot from a string.Get the plot modification managerGets the set home location or 0,Integer#MIN_VALUE,0 if no location is set
- Does not take the default home location into account - PlotSquared will internally find the correct place to teleport to if y = Integer#MIN_VALUE when teleporting to the plot.Gets the ratings associated with a plot
- The rating object may contain multiple categoriesThis 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 locationgetRelative
(@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) int
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 onceGets or create plot settings.void
Deprecated.May cause synchronous chunk loadslong
Gets 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
Get the name of the world that the plot is inint
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_VALUEboolean
hasOwner()
Checks if the plot has an owner.boolean
boolean
Checks if the player is either the owner or on the trusted/added list.boolean
Returns true if the plot is not merged, or it is the base plot of multiple merged plots.boolean
Checks if the player is not permitted on this plot.boolean
isLoaded()
boolean
isMerged()
Checks if this plot is merged in any direction.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
----------boolean
Check if the plot is merged in a given directionboolean
isOnline()
Checks if the owner of this Plot is online.boolean
Checks if a UUID is a plot owner (merged plots may have multiple owners)boolean
isOwnerAbs
(@Nullable UUID uuid) Checks if the given UUID is the owner of this specific plotvoid
Merge the plot settings
- Used when a plot is mergedvoid
mergePlot
(Plot lesserPlot, boolean removeRoads, @Nullable QueueCoordinator queue) Merges two plots.boolean
Moves the settings for a plot.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)boolean
removeDenied
(UUID uuid) Remove a denied player (use DBFunc as well)
Using the * uuid will remove all usersboolean
removeFlag
(@NonNull PlotFlag<?, ?> flag) Remove a flag from this plotboolean
removeFlag
(@NonNull Class<? extends PlotFlag<?, ?>> flag) Remove a flag from this plotboolean
removeMember
(UUID uuid) Remove a trusted user (use DBFunc as well)
Using the * uuid will remove all usersint
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 onceboolean
removeTrusted
(UUID uuid) Remove a helper (use DBFunc as well)
Using the * uuid will remove all usersvoid
Sets the plot alias.void
Assigns this plot to a plot area.
(Mostly used during startup when worlds are being created)void
Sets the denied users for this plot.<V> boolean
Sets a flag for the plot and stores it in the database.boolean
Parse the flag value into a flag instance based on the provided flag class, and store it in the database.void
Sets the home locationvoid
Change the plot IDvoid
setMembers
(@NonNull Set<UUID> uuids) Sets the members for this plot.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.void
Sets the raw merge data
- Updates DB
- Does not modify terrainvoid
Session only plot metadata (session is until the server stops)
For persistent metadata use the flag systemvoid
Sets the plot owner (and update the database)boolean
setOwner
(UUID owner, PlotPlayer<?> initiator) Sets the plot owner (and update the database)void
setOwnerAbs
(@Nullable UUID owner) Set the owner of this exact sub-plot.void
setTrusted
(@NonNull Set<UUID> uuids) Sets the trusted users for this plot.Swaps the settings for two plots.void
teleportPlayer
(PlotPlayer<?> player, TeleportCause cause, Consumer<Boolean> resultConsumer) Teleport a player to a plot and send them the teleport message.void
teleportPlayer
(PlotPlayer<?> player, Consumer<Boolean> result) Teleport a player to a plot and send them the teleport message.toString()
Gets plot display name.boolean
unclaim()
Unclaim the plot (does not modify terrain).void
Expands the world border to include this plot if it is beyond the current border.
-
Field Details
-
MAX_HEIGHT
Deprecated, for removal: This API element is subject to removal in a future version.- See Also:
-
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)See
getPlot(Location)
for existing plots- Parameters:
area
- the PlotArea where the plot is locatedid
- the plot idowner
- the plot owner
-
Plot
Constructor for an unowned plot. (Only changes after plot.create() will be properly set in the database)See
getPlot(Location)
for existing plots- Parameters:
area
- the PlotArea where the plot is locatedid
- the plot id
-
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)See
getPlot(Location)
for existing plots- 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
-
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)See
getPlot(Location)
for existing plots- 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.
-
-
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.Use
PlotPlayer.getCurrentPlot()
if a player is expected here.- Parameters:
location
- the location of the plot- Returns:
- plot at location or null
-
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 asServerPlotFlag
that 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
Checks if the plot has an owner.- Returns:
true
if 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:
true
if 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:
true
if 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: usegetOwners()
Use
getOwnerAbs()
to get the owner as stored in the database- Returns:
- Server if ServerPlot flag set, else
getOwnerAbs()
-
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:
true
if 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:
false
if the player is allowed to enter the plot, elsetrue
-
getId
Gets thePlotId
of 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
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
Checks if this plot is merged in any direction.- Returns:
true
if this plot is merged, otherwisefalse
-
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
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:
true
if 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
-
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
Count the entities in a plot- Returns:
- array of entity counts
- See Also:
-
addRunning
Returns true if a previous task was running- Returns:
true
if a previous task is running
-
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
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
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, otherwisetrue
.
-
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
-
getAverageRating
Gets the average rating of the plot. This is the value displayed in /plot info- Returns:
- average rating as double,
Double.NaN
of 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
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
-
claim
@Deprecated(forRemoval=true, since="6.1.0") 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, since="6.1.0") 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
- Since:
- 6.1.0
-
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
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
Gets the merged array.- Returns:
- boolean [ north, east, south, west ]
-
setMerged
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
-
getPosition
Gets the set home location or 0,Integer#MIN_VALUE,0 if no location is set
- Does not take the default home location into account - PlotSquared will internally find the correct place to teleport to if y = Integer#MIN_VALUE when teleporting to the plot.- 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
Attempt to find the largest rectangular region in a plot (as plots can form non rectangular shapes)- Returns:
- the plot's largest CuboidRegion
-
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
Checks if the owner of this Plot is online.- Returns:
true
if the owner of the Plot is online
-
getDistanceFromOrigin
-
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:
true
if 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
-
getAverageRatings
If rating categories are enabled, get the average rating by category.
- The index corresponds to the index of the category in the configSee
Settings.Ratings.CATEGORIES
for rating categories- Returns:
- Average ratings in each category
-
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
-