Package com.plotsquared.core.queue
Class DelegateQueueCoordinator
java.lang.Object
com.plotsquared.core.queue.QueueCoordinator
com.plotsquared.core.queue.DelegateQueueCoordinator
- Direct Known Subclasses:
AreaBoundDelegateQueueCoordinator
,LocationOffsetDelegateQueueCoordinator
,ScopedQueueCoordinator
Queue that delegates to a parent queue.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addProgressSubscriber(@NonNull ProgressSubscriber progressSubscriber)
Add aProgressSubscriber
to the Queue to subscribe to the relevant Chunk Processorvoid
addReadChunk(@NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
Add aBlockVector2
Chunk coordinate to the Read Chunks listvoid
addReadChunks(@NonNull Set<com.sk89q.worldedit.math.BlockVector2> readChunks)
Add a set ofBlockVector2
Chunk coordinates to the Read Chunks listvoid
cancel()
Cancel the queueboolean
enqueue()
Enqueue the queue to start it@Nullable com.sk89q.worldedit.world.block.BlockState
getBlock(int x, int y, int z)
Get a block at the given coordinates.@Nullable Consumer<com.sk89q.worldedit.math.BlockVector2>
Return the chunk consumer set to the queue or null if one is not setGet the task to be run when all chunks have been accessed@NonNull LightingMode
Get theLightingMode
to be used when setting blocks@NonNull List<com.sk89q.worldedit.math.BlockVector2>
Get the list of chunks that are added manually.@Nullable com.sk89q.worldedit.regions.CuboidRegion
Get theCuboidRegion
designated for direct regeneration@Nullable com.sk89q.worldedit.world.World
getWorld()
Get the world the queue is writing toboolean
Whether the queue has any biomes to be setboolean
Whether the queue has any tiles being setboolean
Whether chunks should be unloaded after being accessedvoid
regenChunk(int x, int z)
Set a specific chunk at the chunk coordinates XZ to be regenerated.boolean
setBiome(int x, int y, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
Set a biome in XYZboolean
setBiome(int x, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
Set a biome in XZ.boolean
setBlock(int x, int y, int z, @NonNull com.sk89q.worldedit.function.pattern.Pattern pattern)
Sets the block at the coordinates provided to the given id.boolean
setBlock(int x, int y, int z, @NonNull com.sk89q.worldedit.world.block.BaseBlock id)
Sets the block at the coordinates provided to the given id.boolean
setBlock(int x, int y, int z, @NonNull com.sk89q.worldedit.world.block.BlockState id)
Sets the block at the coordinates provided to the given id.void
setChunkConsumer(@NonNull Consumer<com.sk89q.worldedit.math.BlockVector2> consumer)
Set the Consumer that will be executed on each chunk in queuevoid
setCompleteTask(Runnable whenDone)
Set the task to be run when all chunks have been accessedboolean
setEntity(@NonNull com.sk89q.worldedit.entity.Entity entity)
Add an entity to be createdvoid
setLightingMode(@Nullable LightingMode mode)
Set theLightingMode
to be used when setting blocksvoid
setModified(long modified)
Set when the queue was last modifiedvoid
setRegenRegion(@NonNull com.sk89q.worldedit.regions.CuboidRegion regenRegion)
Set theCuboidRegion
designated for direct regenerationboolean
setTile(int x, int y, int z, @NonNull com.sk89q.jnbt.CompoundTag tag)
Sets a tile entity at the coordinates provided to the given CompoundTagvoid
setUnloadAfter(boolean setUnloadAfter)
Set whether chunks should be unloaded after being accessedint
size()
Get the size of the queue in chunksvoid
start()
Start the queueMethods inherited from class com.plotsquared.core.queue.QueueCoordinator
addEntities, getChunkObject, getForChunk, isForceSync, setBiomeCuboid, setChunkObject, setCuboid, setCuboid, setForceSync, setModified
-
Constructor Details
-
DelegateQueueCoordinator
-
-
Method Details
-
getParent
-
size
public int size()Description copied from class:QueueCoordinator
Get the size of the queue in chunks- Specified by:
size
in classQueueCoordinator
- Returns:
- size
-
setModified
public void setModified(long modified)Description copied from class:QueueCoordinator
Set when the queue was last modified- Specified by:
setModified
in classQueueCoordinator
- Parameters:
modified
- long of system millis
-
setBlock
public boolean setBlock(int x, int y, int z, @NonNull com.sk89q.worldedit.function.pattern.Pattern pattern)Description copied from class:QueueCoordinator
Sets the block at the coordinates provided to the given id.- Overrides:
setBlock
in classQueueCoordinator
- Parameters:
x
- the x coordinate from from 0 to 15 inclusivey
- the y coordinate from from 0 (inclusive) - maxHeight(exclusive)z
- the z coordinate from 0 to 15 inclusivepattern
- the pattern to set the block to- Returns:
- success or not
-
setBlock
public boolean setBlock(int x, int y, int z, @NonNull com.sk89q.worldedit.world.block.BaseBlock id)Description copied from class:QueueCoordinator
Sets the block at the coordinates provided to the given id.- Specified by:
setBlock
in classQueueCoordinator
- Parameters:
x
- the x coordinate from from 0 to 15 inclusivey
- the y coordinate from from 0 (inclusive) - maxHeight(exclusive)z
- the z coordinate from 0 to 15 inclusiveid
- the BaseBlock to set the block to- Returns:
- success or not
-
setBlock
public boolean setBlock(int x, int y, int z, @NonNull com.sk89q.worldedit.world.block.BlockState id)Description copied from class:QueueCoordinator
Sets the block at the coordinates provided to the given id.- Specified by:
setBlock
in classQueueCoordinator
- Parameters:
x
- the x coordinate from from 0 to 15 inclusivey
- the y coordinate from from 0 (inclusive) - maxHeight(exclusive)z
- the z coordinate from 0 to 15 inclusiveid
- the BlockState to set the block to- Returns:
- success or not
-
getBlock
public @Nullable com.sk89q.worldedit.world.block.BlockState getBlock(int x, int y, int z)Description copied from class:QueueCoordinator
Get a block at the given coordinates.- Specified by:
getBlock
in classQueueCoordinator
- Parameters:
x
- block xy
- block yz
- block z- Returns:
- WorldEdit BlockState
-
setBiome
public boolean setBiome(int x, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)Description copied from class:QueueCoordinator
Set a biome in XZ. This will likely set to the whole column- Specified by:
setBiome
in classQueueCoordinator
- Parameters:
x
- x coordinatez
- z coordinatebiome
- biome- Returns:
- success or not
-
setBiome
public boolean setBiome(int x, int y, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)Description copied from class:QueueCoordinator
Set a biome in XYZ- Specified by:
setBiome
in classQueueCoordinator
- Parameters:
x
- x coordinatey
- y coordinatez
- z coordinatebiome
- biome- Returns:
- success or not
-
isSettingBiomes
public boolean isSettingBiomes()Description copied from class:QueueCoordinator
Whether the queue has any biomes to be set- Specified by:
isSettingBiomes
in classQueueCoordinator
- Returns:
- if setting biomes
-
setEntity
public boolean setEntity(@NonNull com.sk89q.worldedit.entity.Entity entity)Description copied from class:QueueCoordinator
Add an entity to be created- Specified by:
setEntity
in classQueueCoordinator
- Parameters:
entity
- entity to add to queue- Returns:
- success or not
-
regenChunk
public void regenChunk(int x, int z)Description copied from class:QueueCoordinator
Set a specific chunk at the chunk coordinates XZ to be regenerated.- Specified by:
regenChunk
in classQueueCoordinator
- Parameters:
x
- chunk xz
- chunk z
-
getWorld
public @Nullable com.sk89q.worldedit.world.World getWorld()Description copied from class:QueueCoordinator
Get the world the queue is writing to- Specified by:
getWorld
in classQueueCoordinator
- Returns:
- world of the queue
-
setTile
public boolean setTile(int x, int y, int z, @NonNull com.sk89q.jnbt.CompoundTag tag)Description copied from class:QueueCoordinator
Sets a tile entity at the coordinates provided to the given CompoundTag- Specified by:
setTile
in classQueueCoordinator
- Parameters:
x
- the x coordinate from from 0 to 15 inclusivey
- the y coordinate from from 0 (inclusive) - maxHeight(exclusive)z
- the z coordinate from 0 to 15 inclusivetag
- the CompoundTag to set the tile to- Returns:
- success or not
-
isSettingTiles
public boolean isSettingTiles()Description copied from class:QueueCoordinator
Whether the queue has any tiles being set- Specified by:
isSettingTiles
in classQueueCoordinator
- Returns:
- if setting tiles
-
enqueue
public boolean enqueue()Description copied from class:QueueCoordinator
Enqueue the queue to start it- Overrides:
enqueue
in classQueueCoordinator
- Returns:
- success or not
-
start
public void start()Description copied from class:QueueCoordinator
Start the queue- Specified by:
start
in classQueueCoordinator
-
cancel
public void cancel()Description copied from class:QueueCoordinator
Cancel the queue- Specified by:
cancel
in classQueueCoordinator
-
getCompleteTask
Description copied from class:QueueCoordinator
Get the task to be run when all chunks have been accessed- Specified by:
getCompleteTask
in classQueueCoordinator
- Returns:
- task to be run when queue is complete
-
setCompleteTask
Description copied from class:QueueCoordinator
Set the task to be run when all chunks have been accessed- Specified by:
setCompleteTask
in classQueueCoordinator
- Parameters:
whenDone
- task to be run when queue is complete
-
getChunkConsumer
Description copied from class:QueueCoordinator
Return the chunk consumer set to the queue or null if one is not set- Specified by:
getChunkConsumer
in classQueueCoordinator
- Returns:
- Consumer to be executed on each chunk in queue
-
setChunkConsumer
Description copied from class:QueueCoordinator
Set the Consumer that will be executed on each chunk in queue- Specified by:
setChunkConsumer
in classQueueCoordinator
- Parameters:
consumer
- Consumer to be executed on each chunk in queue
-
addProgressSubscriber
Description copied from class:QueueCoordinator
Add aProgressSubscriber
to the Queue to subscribe to the relevant Chunk Processor- Specified by:
addProgressSubscriber
in classQueueCoordinator
-
getLightingMode
Description copied from class:QueueCoordinator
Get theLightingMode
to be used when setting blocks- Specified by:
getLightingMode
in classQueueCoordinator
-
setLightingMode
Description copied from class:QueueCoordinator
Set theLightingMode
to be used when setting blocks- Specified by:
setLightingMode
in classQueueCoordinator
- Parameters:
mode
- lighting mode. Null to use default.
-
getReadChunks
Description copied from class:QueueCoordinator
Get the list of chunks that are added manually. This usually indicated the queue is "read only".- Specified by:
getReadChunks
in classQueueCoordinator
- Returns:
- list of BlockVector2 of chunks that are to be "read"
-
addReadChunks
Description copied from class:QueueCoordinator
Add a set ofBlockVector2
Chunk coordinates to the Read Chunks list- Specified by:
addReadChunks
in classQueueCoordinator
- Parameters:
readChunks
- set of BlockVector2 to add to "read" chunks
-
addReadChunk
public void addReadChunk(@NonNull com.sk89q.worldedit.math.BlockVector2 chunk)Description copied from class:QueueCoordinator
Add aBlockVector2
Chunk coordinate to the Read Chunks list- Specified by:
addReadChunk
in classQueueCoordinator
- Parameters:
chunk
- BlockVector2 to add to "read" chunks
-
isUnloadAfter
public boolean isUnloadAfter()Description copied from class:QueueCoordinator
Whether chunks should be unloaded after being accessed- Specified by:
isUnloadAfter
in classQueueCoordinator
- Returns:
- if is unloading chunks after accessing them
-
setUnloadAfter
public void setUnloadAfter(boolean setUnloadAfter)Description copied from class:QueueCoordinator
Set whether chunks should be unloaded after being accessed- Specified by:
setUnloadAfter
in classQueueCoordinator
- Parameters:
setUnloadAfter
- if to unload chunks after being accessed
-
getRegenRegion
public @Nullable com.sk89q.worldedit.regions.CuboidRegion getRegenRegion()Description copied from class:QueueCoordinator
Get theCuboidRegion
designated for direct regeneration- Specified by:
getRegenRegion
in classQueueCoordinator
- Returns:
- CuboidRegion to regenerate
-
setRegenRegion
public void setRegenRegion(@NonNull com.sk89q.worldedit.regions.CuboidRegion regenRegion)Description copied from class:QueueCoordinator
Set theCuboidRegion
designated for direct regeneration- Specified by:
setRegenRegion
in classQueueCoordinator
- Parameters:
regenRegion
- CuboidRegion to regenerate
-