Package com.plotsquared.core.plot
Class PlotModificationManager
java.lang.Object
com.plotsquared.core.plot.PlotModificationManager
Manager that handles
Plot modifications-
Method Summary
Modifier and TypeMethodDescriptionbooleanautoMerge(@NonNull Direction dir, int max, @NonNull UUID uuid, @Nullable PlotPlayer<?> actor, boolean removeRoads) Auto merge a plot in a specific direction.booleanclear(boolean checkRunning, boolean isDelete, @Nullable PlotPlayer<?> actor, @Nullable Runnable whenDone) Clear the plotvoidClear the plotcopy(@NonNull Plot destination, @Nullable PlotPlayer<?> actor) Copy a plot to a location, both physically and the settingsbooleancreate()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.booleanRegister 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.booleandeletePlot(@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.voidResend all chunks inside the plot to nearby players
This should not need to be calledvoidRemove the east road section of a plot
- Used when a plot is mergedvoidRemove the south road section of a plot
- Used when a plot is mergedvoidRemove the SE road (only effects terrain)voidRemove the plot sign if it is set.voidSets the biome for a plot asynchronously.booleansetComponent(@NonNull String component, @NonNull Pattern blocks, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Sets a component for a plot to the provided blocks
- E.g.booleansetComponent(String component, String blocks, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Deprecated.voidsetSign()Sets the plot sign if plot signs are enabled.voidSets 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 dimensionsbooleanunlink()Unlink a plot and remove the roadsbooleanunlinkPlot(boolean createRoad, boolean createSign) 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
trueif 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
public boolean unlinkPlot(boolean createRoad, boolean createSign) Unlink the plot and all connected plots.- Parameters:
createRoad- whether to recreate roadcreateSign- whether to recreate signs- Returns:
- success/!cancelled
-
setSign
Sets the sign for a plot to a specific name- Parameters:
name- name
-
refreshChunks
public void refreshChunks()Resend all chunks inside the plot to nearby players
This should not need to be called -
removeSign
public void removeSign()Remove the plot sign if it is set. -
setSign
public void setSign()Sets the plot sign if plot signs are enabled. -
create
public boolean 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:
trueif 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:
trueif 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:
trueif 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:
trueif the move was successful, elsefalse
-
unlink
public boolean unlink()Unlink a plot and remove the roads- Returns:
trueif 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
trueif 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
trueif 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:
trueif 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:
trueif the deletion was successful,falseif 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:
trueif the update was successful,falseif 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.
-