Package com.plotsquared.core.queue
Class BasicQueueCoordinator
java.lang.Object
com.plotsquared.core.queue.QueueCoordinator
com.plotsquared.core.queue.BasicQueueCoordinator
Standard block setting queue that allows block setting across numerous chunks, without limits.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddProgressSubscriber(@NonNull ProgressSubscriber progressSubscriber) Add aProgressSubscriberto the Queue to subscribe to the relevant Chunk ProcessorvoidaddReadChunk(@NonNull BlockVector2 chunk) Add aBlockVector2Chunk coordinate to the Read Chunks listvoidaddReadChunks(@NonNull Set<BlockVector2> readRegion) Add a set ofBlockVector2Chunk coordinates to the Read Chunks listabstract BlockStategetBlock(int x, int y, int z) Get a block at the given coordinates.Gets the map of ChunkCoordinates inBlockVector2form against theLocalChunkof cached chunks to be writtenfinal @Nullable Consumer<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 accessedfinal @NonNull LightingModeGet theLightingModeto be used when setting blocksfinal List<ProgressSubscriber>Get the list of progress subscribers currently added to the queue to be added to the Chunk CoordinatorGet the list of chunks that are added manually.int[]Gets the int[x,z] chunk coordinates where regeneration should finishGet theCuboidRegiondesignated for direct regenerationint[]Gets the int[x,z] chunk coordinates where regeneration should start fromgetWorld()Get the world the queue is writing tobooleanisRegen()Whether the queue has a start/end to chunk regenerationbooleanWhether the queue has any biomes to be setbooleanWhether the queue has any tiles being setbooleanWhether chunks should be unloaded after being accessedvoidregenChunk(int x, int z) Set a specific chunk at the chunk coordinates XZ to be regenerated.final booleanSet a biome in XYZbooleanSet a biome in XZ.booleanSets the block at the coordinates provided to the given id.booleanSets the block at the coordinates provided to the given id.booleansetBlock(int x, int y, int z, @NonNull BlockState id) Sets the block at the coordinates provided to the given id.final voidsetChunk(@NonNull LocalChunk chunk) Forces anLocalChunkinto the list of chunks to be written.final voidsetChunkConsumer(@NonNull Consumer<BlockVector2> consumer) Set the Consumer that will be executed on each chunk in queuevoidsetCompleteTask(Runnable whenDone) Set the task to be run when all chunks have been accessedbooleanAdd an entity to be createdfinal voidSet theLightingModeto be used when setting blocksfinal voidsetModified(long modified) Set when the queue was last modifiedvoidsetRegenRegion(@NonNull CuboidRegion regenRegion) Set theCuboidRegiondesignated for direct regenerationbooleansetTile(int x, int y, int z, @NonNull CompoundTag tag) Sets a tile entity at the coordinates provided to the given CompoundTagvoidsetUnloadAfter(boolean unloadAfter) Set whether chunks should be unloaded after being accessedfinal intsize()Get the size of the queue in chunksMethods inherited from class com.plotsquared.core.queue.QueueCoordinator
addEntities, cancel, enqueue, getChunkObject, getForChunk, isForceSync, setBiomeCuboid, setChunkObject, setCuboid, setCuboid, setForceSync, setModified, start
-
Constructor Details
-
BasicQueueCoordinator
-
-
Method Details
-
getBlock
Description copied from class:QueueCoordinatorGet a block at the given coordinates.- Specified by:
getBlockin classQueueCoordinator- Parameters:
x- block xy- block yz- block z- Returns:
- WorldEdit BlockState
-
getWorld
Description copied from class:QueueCoordinatorGet the world the queue is writing to- Specified by:
getWorldin classQueueCoordinator- Returns:
- world of the queue
-
size
public final int size()Description copied from class:QueueCoordinatorGet the size of the queue in chunks- Specified by:
sizein classQueueCoordinator- Returns:
- size
-
setModified
public final void setModified(long modified) Description copied from class:QueueCoordinatorSet when the queue was last modified- Specified by:
setModifiedin classQueueCoordinator- Parameters:
modified- long of system millis
-
setBlock
Description copied from class:QueueCoordinatorSets the block at the coordinates provided to the given id.- Overrides:
setBlockin 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
Description copied from class:QueueCoordinatorSets the block at the coordinates provided to the given id.- Specified by:
setBlockin 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
Description copied from class:QueueCoordinatorSets the block at the coordinates provided to the given id.- Specified by:
setBlockin 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
-
setBiome
Description copied from class:QueueCoordinatorSet a biome in XZ. This will likely set to the whole column- Specified by:
setBiomein classQueueCoordinator- Parameters:
x- x coordinatez- z coordinatebiomeType- biome- Returns:
- success or not
-
setBiome
Description copied from class:QueueCoordinatorSet a biome in XYZ- Specified by:
setBiomein classQueueCoordinator- Parameters:
x- x coordinatey- y coordinatez- z coordinatebiomeType- biome- Returns:
- success or not
-
isSettingBiomes
public boolean isSettingBiomes()Description copied from class:QueueCoordinatorWhether the queue has any biomes to be set- Specified by:
isSettingBiomesin classQueueCoordinator- Returns:
- if setting biomes
-
setTile
Description copied from class:QueueCoordinatorSets a tile entity at the coordinates provided to the given CompoundTag- Specified by:
setTilein 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:QueueCoordinatorWhether the queue has any tiles being set- Specified by:
isSettingTilesin classQueueCoordinator- Returns:
- if setting tiles
-
setEntity
Description copied from class:QueueCoordinatorAdd an entity to be created- Specified by:
setEntityin classQueueCoordinator- Parameters:
entity- entity to add to queue- Returns:
- success or not
-
getReadChunks
Description copied from class:QueueCoordinatorGet the list of chunks that are added manually. This usually indicated the queue is "read only".- Specified by:
getReadChunksin classQueueCoordinator- Returns:
- list of BlockVector2 of chunks that are to be "read"
-
addReadChunk
Description copied from class:QueueCoordinatorAdd aBlockVector2Chunk coordinate to the Read Chunks list- Specified by:
addReadChunkin classQueueCoordinator- Parameters:
chunk- BlockVector2 to add to "read" chunks
-
addReadChunks
Description copied from class:QueueCoordinatorAdd a set ofBlockVector2Chunk coordinates to the Read Chunks list- Specified by:
addReadChunksin classQueueCoordinator- Parameters:
readRegion- set of BlockVector2 to add to "read" chunks
-
getRegenRegion
Description copied from class:QueueCoordinatorGet theCuboidRegiondesignated for direct regeneration- Specified by:
getRegenRegionin classQueueCoordinator- Returns:
- CuboidRegion to regenerate
-
setRegenRegion
Description copied from class:QueueCoordinatorSet theCuboidRegiondesignated for direct regeneration- Specified by:
setRegenRegionin classQueueCoordinator- Parameters:
regenRegion- CuboidRegion to regenerate
-
regenChunk
public void regenChunk(int x, int z) Description copied from class:QueueCoordinatorSet a specific chunk at the chunk coordinates XZ to be regenerated.- Specified by:
regenChunkin classQueueCoordinator- Parameters:
x- chunk xz- chunk z
-
isUnloadAfter
public boolean isUnloadAfter()Description copied from class:QueueCoordinatorWhether chunks should be unloaded after being accessed- Specified by:
isUnloadAfterin classQueueCoordinator- Returns:
- if is unloading chunks after accessing them
-
setUnloadAfter
public void setUnloadAfter(boolean unloadAfter) Description copied from class:QueueCoordinatorSet whether chunks should be unloaded after being accessed- Specified by:
setUnloadAfterin classQueueCoordinator- Parameters:
unloadAfter- if to unload chunks after being accessed
-
getRegenStart
public int[] getRegenStart()Gets the int[x,z] chunk coordinates where regeneration should start from- Returns:
- int[x, z] of regen start
-
getRegenEnd
public int[] getRegenEnd()Gets the int[x,z] chunk coordinates where regeneration should finish- Returns:
- int[x, z] of regen end
-
isRegen
public boolean isRegen()Whether the queue has a start/end to chunk regeneration- Returns:
- if is regenerating queue with int[x,z] start and end
-
getBlockChunks
Gets the map of ChunkCoordinates inBlockVector2form against theLocalChunkof cached chunks to be written- Returns:
- ConcurrentHashMap of chunks to be accessed
-
setChunk
Forces anLocalChunkinto the list of chunks to be written. Overwrites existing chunks in the map- Parameters:
chunk- add a LocalChunk to be written to by the queue
-
getChunkConsumer
Description copied from class:QueueCoordinatorReturn the chunk consumer set to the queue or null if one is not set- Specified by:
getChunkConsumerin classQueueCoordinator- Returns:
- Consumer to be executed on each chunk in queue
-
setChunkConsumer
Description copied from class:QueueCoordinatorSet the Consumer that will be executed on each chunk in queue- Specified by:
setChunkConsumerin classQueueCoordinator- Parameters:
consumer- Consumer to be executed on each chunk in queue
-
getProgressSubscribers
Get the list of progress subscribers currently added to the queue to be added to the Chunk Coordinator -
addProgressSubscriber
Description copied from class:QueueCoordinatorAdd aProgressSubscriberto the Queue to subscribe to the relevant Chunk Processor- Specified by:
addProgressSubscriberin classQueueCoordinator
-
getLightingMode
Description copied from class:QueueCoordinatorGet theLightingModeto be used when setting blocks- Specified by:
getLightingModein classQueueCoordinator
-
setLightingMode
Description copied from class:QueueCoordinatorSet theLightingModeto be used when setting blocks- Specified by:
setLightingModein classQueueCoordinator- Parameters:
mode- lighting mode. Null to use default.
-
getCompleteTask
Description copied from class:QueueCoordinatorGet the task to be run when all chunks have been accessed- Specified by:
getCompleteTaskin classQueueCoordinator- Returns:
- task to be run when queue is complete
-
setCompleteTask
Description copied from class:QueueCoordinatorSet the task to be run when all chunks have been accessed- Specified by:
setCompleteTaskin classQueueCoordinator- Parameters:
whenDone- task to be run when queue is complete
-