Package com.plotsquared.core.util
Class RegionManager
java.lang.Object
com.plotsquared.core.util.RegionManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegionManager(@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<com.sk89q.worldedit.math.BlockVector2> chunks, Runnable whenDone)
static com.sk89q.worldedit.math.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(com.sk89q.worldedit.regions.CuboidRegion region, int extendBiome, com.sk89q.worldedit.world.biome.BiomeType biome, String world, Runnable whenDone)
boolean
setCuboids(@NonNull PlotArea area, @NonNull Set<com.sk89q.worldedit.regions.CuboidRegion> regions, @NonNull com.sk89q.worldedit.function.pattern.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
-
-
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
public void deleteRegionFiles(String world, Collection<com.sk89q.worldedit.math.BlockVector2> chunks, Runnable whenDone) -
setCuboids
public boolean setCuboids(@NonNull PlotArea area, @NonNull Set<com.sk89q.worldedit.regions.CuboidRegion> regions, @NonNull com.sk89q.worldedit.function.pattern.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 P2 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
-