Package com.plotsquared.core.util
Class RegionManager
java.lang.Object
com.plotsquared.core.util.RegionManager
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRegionManager
(@NonNull WorldUtil worldUtil, @NonNull GlobalBlockQueue blockQueue, @NonNull ProgressSubscriberFactory subscriberFactory) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
clearAllEntities
(Location pos1, Location pos2) boolean
copyRegion
(@NonNull Location pos1, @NonNull Location pos2, @NonNull Location newPos, @Nullable PlotPlayer<?> actor, @NonNull Runnable whenDone) Copy a region to a new location (in the same world)abstract int[]
countEntities
(Plot plot) 0 = Entity 1 = Animal 2 = Monster 3 = Mob 4 = Boat 5 = Miscvoid
deleteRegionFiles
(String world, Collection<BlockVector2> chunks, Runnable whenDone) static BlockVector2
abstract boolean
handleClear
(@NonNull Plot plot, @Nullable Runnable whenDone, @NonNull PlotManager manager, @Nullable PlotPlayer<?> actor) Only called whennotifyClear(PlotManager)
returns true in specific PlotManagersboolean
notifyClear
(PlotManager manager) Notify any plugins that may want to modify clear behaviour that a clear is occuringabstract boolean
regenerateRegion
(Location pos1, Location pos2, boolean ignoreAugment, Runnable whenDone) Assumptions:
- pos1 and pos2 are in the same plot
It can be harmful to the world if parameters outside this scope are providedvoid
setBiome
(CuboidRegion region, int extendBiome, BiomeType biome, PlotArea area, Runnable whenDone) Set a region to a biome type.void
setBiome
(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) Deprecated, for removal: This API element is subject to removal in a future version.boolean
setCuboids
(@NonNull PlotArea area, @NonNull Set<CuboidRegion> regions, @NonNull Pattern blocks, int minY, int maxY, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Set a number of cuboids to a certain block between two y values.void
swap
(Location pos1, Location pos2, Location swapPos, @Nullable PlotPlayer<?> actor, Runnable whenDone) Swap two regions within the same world
-
Field Details
-
manager
-
worldUtil
-
-
Constructor Details
-
RegionManager
@Inject public RegionManager(@NonNull WorldUtil worldUtil, @NonNull GlobalBlockQueue blockQueue, @NonNull ProgressSubscriberFactory subscriberFactory)
-
-
Method Details
-
getRegion
-
countEntities
0 = Entity 1 = Animal 2 = Monster 3 = Mob 4 = Boat 5 = Misc- Parameters:
plot
- plot- Returns:
- array of counts of entity types
-
deleteRegionFiles
-
setCuboids
public boolean setCuboids(@NonNull PlotArea area, @NonNull Set<CuboidRegion> regions, @NonNull Pattern blocks, int minY, int maxY, @Nullable PlotPlayer<?> actor, @Nullable QueueCoordinator queue) Set a number of cuboids to a certain block between two y values.- Parameters:
area
- plot arearegions
- cuboid regionsblocks
- patternminY
- y to set frommaxY
- y to set toactor
- the actor associated with the cuboid setqueue
- NullableQueueCoordinator
. If null, creates own queue and enqueues, otherwise writes to the queue but does not enqueue.- Returns:
true
if not enqueued, otherwise whether the created queue enqueued.
-
notifyClear
Notify any plugins that may want to modify clear behaviour that a clear is occuring- Parameters:
manager
- plot manager- Returns:
true
if the notified will accept the clear task
-
handleClear
public abstract boolean handleClear(@NonNull Plot plot, @Nullable Runnable whenDone, @NonNull PlotManager manager, @Nullable PlotPlayer<?> actor) Only called whennotifyClear(PlotManager)
returns true in specific PlotManagers- Parameters:
plot
- plotwhenDone
- task to run when completemanager
- plot manageractor
- the player running the clear- Returns:
true
if the clear worked.false
if someone went wrong so PlotSquared can then handle the clear
-
copyRegion
public boolean copyRegion(@NonNull Location pos1, @NonNull Location pos2, @NonNull Location newPos, @Nullable PlotPlayer<?> actor, @NonNull Runnable whenDone) Copy a region to a new location (in the same world)- Parameters:
pos1
- position 1pos2
- position 2newPos
- position to move pos1 toactor
- the actor associated with the region copywhenDone
- task to run when complete- Returns:
- success or not
-
regenerateRegion
public abstract boolean regenerateRegion(Location pos1, Location pos2, boolean ignoreAugment, Runnable whenDone) Assumptions:
- pos1 and pos2 are in the same plot
It can be harmful to the world if parameters outside this scope are provided- Parameters:
pos1
- position 1pos2
- position 2ignoreAugment
- if to bypass synchronisation ish thingwhenDone
- task to run when regeneration completed- Returns:
- success or not
-
clearAllEntities
-
swap
public void swap(Location pos1, Location pos2, Location swapPos, @Nullable PlotPlayer<?> actor, Runnable whenDone) Swap two regions within the same world- Parameters:
pos1
- position 1pos2
- position 2swapPos
- position to swap withactor
- the actor associated with the region copywhenDone
- task to run when complete
-
setBiome
@Deprecated(forRemoval=true, since="6.6.0") public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) Deprecated, for removal: This API element is subject to removal in a future version. -
setBiome
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, PlotArea area, Runnable whenDone) Set a region to a biome type.- Parameters:
region
- region to setextendBiome
- how far outside the region to extent setting the biome too account for 3D biomes being 4x4biome
- biome to setarea
-PlotArea
in which the biome is being setwhenDone
- task to run when complete- Since:
- 6.6.0
-