Package com.plotsquared.core.queue
Class QueueCoordinator
java.lang.Object
com.plotsquared.core.queue.QueueCoordinator
- Direct Known Subclasses:
BasicQueueCoordinator
,DelegateQueueCoordinator
-
Constructor Summary
ConstructorDescriptionQueueCoordinator
(@Nullable World world) Default constructor requires world to indicate any extents given toQueueCoordinator
also need this constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntities
(@NonNull List<? extends Entity> entities) Add entities to be createdabstract void
addProgressSubscriber
(@NonNull ProgressSubscriber progressSubscriber) Add aProgressSubscriber
to the Queue to subscribe to the relevant Chunk Processorabstract void
addReadChunk
(@NonNull BlockVector2 chunk) Add aBlockVector2
Chunk coordinate to the Read Chunks listabstract void
addReadChunks
(@NonNull Set<BlockVector2> readChunks) Add a set ofBlockVector2
Chunk coordinates to the Read Chunks listabstract void
cancel()
Cancel the queueboolean
enqueue()
Enqueue the queue to start itabstract @Nullable BlockState
getBlock
(int x, int y, int z) Get a block at the given coordinates.abstract @Nullable Consumer<BlockVector2>
Return the chunk consumer set to the queue or null if one is not setGet the Chunk Object set to the queueabstract Runnable
Get the task to be run when all chunks have been accessedgetForChunk
(int x, int z) Deprecated, for removal: This API element is subject to removal in a future version.getForChunk
(int x, int z, int minY, int maxY) Deprecated, for removal: This API element is subject to removal in a future version.ScopedQueueCoordinator
will be renamed in v7.abstract @NonNull LightingMode
Get theLightingMode
to be used when setting blocksprotected int
Get the max chunk layer associated with the queue.protected int
getMaxY()
Get the max Y limit associated with the queueprotected int
Get the min chunk layer associated with the queue.protected int
getMinY()
Get the min Y limit associated with the queueabstract @NonNull List<BlockVector2>
Get the list of chunks that are added manually.abstract @Nullable CuboidRegion
Get theCuboidRegion
designated for direct regenerationabstract @Nullable SideEffectSet
Get the overridingSideEffectSet
to be used by the queue if it exists, else nullgetWorld()
Get the world the queue is writing toboolean
Returns true if the queue should be forced to be synchronous when enqueued.abstract boolean
Whether the queue has any biomes to be setabstract boolean
Whether the queue has any tiles being setabstract boolean
Whether chunks should be unloaded after being accessedabstract void
regenChunk
(int x, int z) Set a specific chunk at the chunk coordinates XZ to be regenerated.abstract boolean
Set a biome in XYZabstract boolean
Deprecated, for removal: This API element is subject to removal in a future version.Biomes now take XYZ, seesetBiome(int, int, int, BiomeType)
Scheduled for removal once we drop the support for versions not supporting 3D biomes, 1.18 and earlier.void
Fill a cuboid between two positions with a BiomeTypeabstract void
setBiomesEnabled
(boolean enabled) If the queue should accept biome placementboolean
Sets the block at the coordinates provided to the given id.abstract boolean
Sets the block at the coordinates provided to the given id.abstract boolean
setBlock
(int x, int y, int z, @NonNull BlockState id) Sets the block at the coordinates provided to the given id.abstract void
setChunkConsumer
(@NonNull Consumer<BlockVector2> consumer) Set the Consumer that will be executed on each chunk in queuevoid
setChunkObject
(@NonNull Object chunkObject) Set a chunk object (e.g.abstract void
setCompleteTask
(@Nullable Runnable whenDone) Set the task to be run when all chunks have been accessedvoid
Fill a cuboid between two positions with a Patternvoid
Fill a cuboid between two positions with a BlockStateabstract boolean
Add an entity to be createdvoid
setForceSync
(boolean forceSync) Set whether the queue should be forced to be synchronous.abstract void
Set theLightingMode
to be used when setting blocksfinal void
Set the queue as having been modified nowabstract void
setModified
(long modified) Set when the queue was last modifiedabstract void
setRegenRegion
(@NonNull CuboidRegion regenRegion) Set theCuboidRegion
designated for direct regenerationabstract void
setSideEffectSet
(@Nullable SideEffectSet sideEffectSet) Set the overridingSideEffectSet
to be used by the queue.abstract boolean
setTile
(int x, int y, int z, @NonNull CompoundTag tag) Sets a tile entity at the coordinates provided to the given CompoundTagabstract void
setUnloadAfter
(boolean unloadAfter) Set whether chunks should be unloaded after being accessedabstract int
size()
Get the size of the queue in chunksabstract void
start()
Start the queue
-
Constructor Details
-
QueueCoordinator
Default constructor requires world to indicate any extents given toQueueCoordinator
also need this constructor.- Parameters:
world
- world as all queues should have this constructor
-
-
Method Details
-
getForChunk
Deprecated, for removal: This API element is subject to removal in a future version.Get aScopedQueueCoordinator
limited to the chunk at the specific chunk Coordinates- Parameters:
x
- chunk x coordinatez
- chunk z coordinate- Returns:
- a new
ScopedQueueCoordinator
-
getForChunk
@Deprecated(forRemoval=true, since="6.9.0") public ScopedQueueCoordinator getForChunk(int x, int z, int minY, int maxY) Deprecated, for removal: This API element is subject to removal in a future version.ScopedQueueCoordinator
will be renamed in v7.Get aScopedQueueCoordinator
limited to the chunk at the specific chunk Coordinates- Parameters:
x
- chunk x coordinatez
- chunk z coordinate- Returns:
- a new
ScopedQueueCoordinator
- Since:
- 6.6.0
-
size
Get the size of the queue in chunks- Returns:
- size
-
setModified
Set when the queue was last modified- Parameters:
modified
- long of system millis
-
isForceSync
Returns true if the queue should be forced to be synchronous when enqueued. This is not necessarily synchronous to the server, and simply effectively makesenqueue()
a blocking operation.- Returns:
- is force sync
-
setForceSync
Set whether the queue should be forced to be synchronous. This is not necessarily synchronous to the server, and simply effectively makesenqueue()
a blocking operation.- Parameters:
forceSync
- force sync or not
-
getChunkObject
Get the Chunk Object set to the queue- Returns:
- chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
-
setChunkObject
Set a chunk object (e.g. the Bukkit Chunk object) to the queue. This will be used as fallback in case of WNA failure. Should ONLY be used in specific cases (i.e. generation, where a chunk is being populated)- Parameters:
chunkObject
- chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
-
setBlock
Sets the block at the coordinates provided to the given id.- 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
-
setBlock
Sets the block at the coordinates provided to the given id.- 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
Sets the block at the coordinates provided to the given id.- 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
-
setTile
Sets a tile entity at the coordinates provided to the given CompoundTag- 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
Whether the queue has any tiles being set- Returns:
- if setting tiles
-
getBlock
Get a block at the given coordinates.- Parameters:
x
- block xy
- block yz
- block z- Returns:
- WorldEdit BlockState
-
setBiome
@Deprecated(forRemoval=true, since="6.0.0") public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome) Deprecated, for removal: This API element is subject to removal in a future version.Biomes now take XYZ, seesetBiome(int, int, int, BiomeType)
Scheduled for removal once we drop the support for versions not supporting 3D biomes, 1.18 and earlier.Set a biome in XZ. This will likely set to the whole column- Parameters:
x
- x coordinatez
- z coordinatebiome
- biome- Returns:
- success or not
-
setBiome
Set a biome in XYZ- Parameters:
x
- x coordinatey
- y coordinatez
- z coordinatebiome
- biome- Returns:
- success or not
-
isSettingBiomes
Whether the queue has any biomes to be set- Returns:
- if setting biomes
-
setBiomesEnabled
If the queue should accept biome placement- Parameters:
enabled
- If biomes should be enabled- Since:
- 6.8.0
-
addEntities
Add entities to be created- Parameters:
entities
- list of entities to add to queue
-
setEntity
Add an entity to be created- Parameters:
entity
- entity to add to queue- Returns:
- success or not
-
getReadChunks
Get the list of chunks that are added manually. This usually indicated the queue is "read only".- Returns:
- list of BlockVector2 of chunks that are to be "read"
-
addReadChunks
Add a set ofBlockVector2
Chunk coordinates to the Read Chunks list- Parameters:
readChunks
- set of BlockVector2 to add to "read" chunks
-
addReadChunk
Add aBlockVector2
Chunk coordinate to the Read Chunks list- Parameters:
chunk
- BlockVector2 to add to "read" chunks
-
isUnloadAfter
Whether chunks should be unloaded after being accessed- Returns:
- if is unloading chunks after accessing them
-
setUnloadAfter
Set whether chunks should be unloaded after being accessed- Parameters:
unloadAfter
- if to unload chunks after being accessed
-
getRegenRegion
Get theCuboidRegion
designated for direct regeneration- Returns:
- CuboidRegion to regenerate
-
setRegenRegion
Set theCuboidRegion
designated for direct regeneration- Parameters:
regenRegion
- CuboidRegion to regenerate
-
regenChunk
Set a specific chunk at the chunk coordinates XZ to be regenerated.- Parameters:
x
- chunk xz
- chunk z
-
getWorld
Get the world the queue is writing to- Returns:
- world of the queue
-
setModified
Set the queue as having been modified now -
enqueue
Enqueue the queue to start it- Returns:
- success or not
- Since:
- 6.0.10
-
start
Start the queue -
cancel
Cancel the queue -
getCompleteTask
Get the task to be run when all chunks have been accessed- Returns:
- task to be run when queue is complete
-
setCompleteTask
Set the task to be run when all chunks have been accessed- Parameters:
whenDone
- task to be run when queue is complete
-
getChunkConsumer
Return the chunk consumer set to the queue or null if one is not set- Returns:
- Consumer to be executed on each chunk in queue
-
setChunkConsumer
Set the Consumer that will be executed on each chunk in queue- Parameters:
consumer
- Consumer to be executed on each chunk in queue
-
addProgressSubscriber
Add aProgressSubscriber
to the Queue to subscribe to the relevant Chunk Processor -
getLightingMode
Get theLightingMode
to be used when setting blocks -
setLightingMode
Set theLightingMode
to be used when setting blocks- Parameters:
mode
- lighting mode. Null to use default.
-
getSideEffectSet
Get the overridingSideEffectSet
to be used by the queue if it exists, else null- Returns:
- Overriding
SideEffectSet
or null
-
setSideEffectSet
Set the overridingSideEffectSet
to be used by the queue. Null to use default side effects.- Parameters:
sideEffectSet
- side effects to override with, or null to use default
-
setCuboid
Fill a cuboid between two positions with a BlockState- Parameters:
pos1
- 1st cuboid positionpos2
- 2nd cuboid positionblock
- block to fill
-
setCuboid
Fill a cuboid between two positions with a Pattern- Parameters:
pos1
- 1st cuboid positionpos2
- 2nd cuboid positionblocks
- pattern to fill
-
setBiomeCuboid
public void setBiomeCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull BiomeType biome) Fill a cuboid between two positions with a BiomeType- Parameters:
pos1
- 1st cuboid positionpos2
- 2nd cuboid positionbiome
- biome to fill
-
getMinY
Get the min Y limit associated with the queue -
getMaxY
Get the max Y limit associated with the queue -
getMinLayer
Get the min chunk layer associated with the queue. Usually 0 or -4; -
getMaxLayer
Get the max chunk layer associated with the queue. Usually 15 or 19
-
getForChunk(int, int, int, int)