Package com.plotsquared.core.plot
Class PlotModificationManager
java.lang.Object
com.plotsquared.core.plot.PlotModificationManager
Manager that handles
Plot
modifications-
Method Summary
Modifier and TypeMethodDescriptionboolean
autoMerge
(@NonNull Direction dir, int max, @NonNull UUID uuid, @Nullable PlotPlayer<?> actor, boolean removeRoads) Auto merge a plot in a specific direction.boolean
clear
(boolean checkRunning, boolean isDelete, @Nullable PlotPlayer<?> actor, @Nullable Runnable whenDone) Clear the plotvoid
Clear the plotcopy
(@NonNull Plot destination, @Nullable PlotPlayer<?> actor) Copy a plot to a location, both physically and the settingsboolean
create()
Register a plot and create it in the database
- The plot will not be created if the owner is null
- Any setting from before plot creation will not be saved until the server is stopped properly.boolean
Register a plot and create it in the database
- The plot will not be created if the owner is null
- Any setting from before plot creation will not be saved until the server is stopped properly.boolean
deletePlot
(@Nullable PlotPlayer<?> actor, Runnable whenDone) Delete a plot (use null for the runnable if you don't need to be notified on completion)Moves the plot to an empty location
- The location must be emptymove
(@NonNull Plot destination, @Nullable PlotPlayer<?> actor, @NonNull Runnable whenDone, boolean allowSwap) Moves a plot physically, as well as the corresponding settings.void
Resend all chunks inside the plot to nearby players
This should not need to be calledvoid
Remove the east road section of a plot
- Used when a plot is mergedvoid
Remove the south road section of a plot
- Used when a plot is mergedvoid
Remove the SE road (only effects terrain)void
Remove the plot sign if it is set.void
Sets the biome for a plot asynchronously.boolean
setComponent
(@NonNull String component, @NonNull Pattern blocks, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Sets a component for a plot to the provided blocks
- E.g.boolean
setComponent
(String component, String blocks, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Deprecated.void
setSign()
Sets the plot sign if plot signs are enabled.void
Sets the sign for a plot to a specific nameSwap the plot contents and settings with another location
- The destination must correspond to a valid plot of equal dimensionsboolean
unlink()
Unlink a plot and remove the roadsboolean
unlinkPlot
(boolean createRoad, boolean createSign) Unlink the plot and all connected plots.boolean
unlinkPlot
(boolean createRoad, boolean createSign, Runnable whenDone) Unlink the plot and all connected plots.
-
Method Details
-
copy
Copy a plot to a location, both physically and the settings- Parameters:
destination
- destination plotactor
- the actor associated with the copy- Returns:
- Future that completes with
true
if the copy was successful, elsefalse
-
clear
Clear the plotUse
deletePlot(PlotPlayer, Runnable)
to clear and delete a plot- Parameters:
whenDone
- A runnable to execute when clearing finishes, or null- See Also:
-
clear
public boolean clear(boolean checkRunning, boolean isDelete, @Nullable PlotPlayer<?> actor, @Nullable Runnable whenDone) Clear the plotUse
deletePlot(PlotPlayer, Runnable)
to clear and delete a plot- Parameters:
checkRunning
- Whether or not already executing tasks should be checkedisDelete
- Whether or not the plot is being deletedactor
- The actor clearing the plotwhenDone
- A runnable to execute when clearing finishes, or null
-
setBiome
Sets the biome for a plot asynchronously.- Parameters:
biome
- The biome e.g. "forest"whenDone
- The task to run when finished, or null
-
unlinkPlot
Unlink the plot and all connected plots.- Parameters:
createRoad
- whether to recreate roadcreateSign
- whether to recreate signs- Returns:
- success/!cancelled
-
unlinkPlot
Unlink the plot and all connected plots.- Parameters:
createRoad
- whether to recreate roadcreateSign
- whether to recreate signswhenDone
- Task to run when unlink is complete- Returns:
- success/!cancelled
- Since:
- 6.10.9
-
setSign
Sets the sign for a plot to a specific name- Parameters:
name
- name
-
refreshChunks
Resend all chunks inside the plot to nearby players
This should not need to be called -
removeSign
Remove the plot sign if it is set. -
setSign
Sets the plot sign if plot signs are enabled. -
create
Register a plot and create it in the database
- The plot will not be created if the owner is null
- Any setting from before plot creation will not be saved until the server is stopped properly. i.e. Set any values/options after plot creation.- Returns:
true
if plot was created successfully
-
create
Register a plot and create it in the database
- The plot will not be created if the owner is null
- Any setting from before plot creation will not be saved until the server is stopped properly. i.e. Set any values/options after plot creation.- Parameters:
uuid
- the uuid of the plot ownernotify
- notify- Returns:
true
if plot was created successfully, elsefalse
-
autoMerge
public boolean autoMerge(@NonNull Direction dir, int max, @NonNull UUID uuid, @Nullable PlotPlayer<?> actor, boolean removeRoads) Auto merge a plot in a specific direction.- Parameters:
dir
- the direction to mergemax
- the max number of merges to douuid
- the UUID it is allowed to merge withactor
- The actor executing the taskremoveRoads
- whether to remove roads- Returns:
true
if a merge takes place, elsefalse
-
move
public @NonNull CompletableFuture<Boolean> move(@NonNull Plot destination, @Nullable PlotPlayer<?> actor, @NonNull Runnable whenDone, boolean allowSwap) Moves a plot physically, as well as the corresponding settings.- Parameters:
destination
- Plot moved toactor
- The actor executing the taskwhenDone
- task when doneallowSwap
- whether to swap plots- Returns:
true
if the move was successful, elsefalse
-
unlink
Unlink a plot and remove the roads- Returns:
true
if plot was linked- See Also:
-
swap
public @NonNull CompletableFuture<Boolean> swap(@NonNull Plot destination, @Nullable PlotPlayer<?> actor, @NonNull Runnable whenDone) Swap the plot contents and settings with another location
- The destination must correspond to a valid plot of equal dimensions- Parameters:
destination
- The other plot to swap withactor
- The actor executing the taskwhenDone
- A task to run when finished, or null- Returns:
- Future that completes with
true
if the swap was successful, elsefalse
-
move
public @NonNull CompletableFuture<Boolean> move(@NonNull Plot destination, @Nullable PlotPlayer<?> actor, @NonNull Runnable whenDone) Moves the plot to an empty location
- The location must be empty- Parameters:
destination
- Where to move the plotactor
- The actor executing the taskwhenDone
- A task to run when done, or null- Returns:
- Future that completes with
true
if the move was successful, elsefalse
-
setComponent
public boolean setComponent(@NonNull String component, @NonNull Pattern blocks, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Sets a component for a plot to the provided blocks
- E.g. floor, wall, border etc.
- The available components depend on the generator being used- Parameters:
component
- Component to setblocks
- Pattern to use the generationactor
- The actor executing the taskqueue
- NullableQueueCoordinator
. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.- Returns:
true
if the component was set successfully, elsefalse
-
deletePlot
Delete a plot (use null for the runnable if you don't need to be notified on completion)Use
clear(boolean, boolean, PlotPlayer, Runnable)
to simply clear a plot- Parameters:
actor
- The actor executing the taskwhenDone
- task to run when plot has been deleted. Nullable- Returns:
true
if the deletion was successful,false
if not- See Also:
-
setComponent
@Deprecated public boolean setComponent(String component, String blocks, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Deprecated./** Sets components such as border, wall, floor. (components are generator specific)- Parameters:
component
- component to setblocks
- string of block(s) to set component toactor
- The player executing the taskqueue
- NullableQueueCoordinator
. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.- Returns:
true
if the update was successful,false
if not
-
removeRoadSouth
Remove the south road section of a plot
- Used when a plot is merged- Parameters:
queue
- NullableQueueCoordinator
. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.
-
removeRoadEast
Remove the east road section of a plot
- Used when a plot is merged- Parameters:
queue
- NullableQueueCoordinator
. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.
-
removeRoadSouthEast
Remove the SE road (only effects terrain)- Parameters:
queue
- NullableQueueCoordinator
. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.
-