Class QueueCoordinator

java.lang.Object
com.plotsquared.core.queue.QueueCoordinator
Direct Known Subclasses:
BasicQueueCoordinator, DelegateQueueCoordinator

public abstract class QueueCoordinator extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    QueueCoordinator​(@Nullable com.sk89q.worldedit.world.World world)
    Default constructor requires world to indicate any extents given to QueueCoordinator also need this constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEntities​(@NonNull List<? extends com.sk89q.worldedit.entity.Entity> entities)
    Add entities to be created
    abstract void
    addProgressSubscriber​(@NonNull ProgressSubscriber progressSubscriber)
    Add a ProgressSubscriber to the Queue to subscribe to the relevant Chunk Processor
    abstract void
    addReadChunk​(@NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
    Add a BlockVector2 Chunk coordinate to the Read Chunks list
    abstract void
    addReadChunks​(@NonNull Set<com.sk89q.worldedit.math.BlockVector2> readChunks)
    Add a set of BlockVector2 Chunk coordinates to the Read Chunks list
    abstract void
    Cancel the queue
    boolean
    Enqueue the queue to start it
    abstract @Nullable com.sk89q.worldedit.world.block.BlockState
    getBlock​(int x, int y, int z)
    Get a block at the given coordinates.
    abstract @Nullable Consumer<com.sk89q.worldedit.math.BlockVector2>
    Return the chunk consumer set to the queue or null if one is not set
    @Nullable Object
    Get the Chunk Object set to the queue
    abstract Runnable
    Get the task to be run when all chunks have been accessed
    getForChunk​(int x, int z)
    Get a ScopedQueueCoordinator limited to the chunk at the specific chunk Coordinates
    abstract @NonNull LightingMode
    Get the LightingMode to be used when setting blocks
    abstract @NonNull List<com.sk89q.worldedit.math.BlockVector2>
    Get the list of chunks that are added manually.
    abstract @Nullable com.sk89q.worldedit.regions.CuboidRegion
    Get the CuboidRegion designated for direct regeneration
    abstract @Nullable com.sk89q.worldedit.world.World
    Get the world the queue is writing to
    boolean
    Returns true if the queue should be forced to be synchronous when enqueued.
    abstract boolean
    Whether the queue has any biomes to be set
    abstract boolean
    Whether the queue has any tiles being set
    abstract boolean
    Whether chunks should be unloaded after being accessed
    abstract void
    regenChunk​(int x, int z)
    Set a specific chunk at the chunk coordinates XZ to be regenerated.
    abstract boolean
    setBiome​(int x, int y, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
    Set a biome in XYZ
    abstract boolean
    setBiome​(int x, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Biomes now take XYZ, see setBiome(int, int, int, BiomeType)
    Scheduled for removal once we drop the support for versions not supporting 3D biomes.
    void
    setBiomeCuboid​(@NonNull Location pos1, @NonNull Location pos2, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
    Fill a cuboid between two positions with a BiomeType
    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.
    abstract 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.
    abstract 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.
    abstract void
    setChunkConsumer​(@NonNull Consumer<com.sk89q.worldedit.math.BlockVector2> consumer)
    Set the Consumer that will be executed on each chunk in queue
    void
    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 accessed
    void
    setCuboid​(@NonNull Location pos1, @NonNull Location pos2, @NonNull com.sk89q.worldedit.function.pattern.Pattern blocks)
    Fill a cuboid between two positions with a Pattern
    void
    setCuboid​(@NonNull Location pos1, @NonNull Location pos2, @NonNull com.sk89q.worldedit.world.block.BlockState block)
    Fill a cuboid between two positions with a BlockState
    abstract boolean
    setEntity​(@NonNull com.sk89q.worldedit.entity.Entity entity)
    Add an entity to be created
    void
    setForceSync​(boolean forceSync)
    Set whether the queue should be forced to be synchronous
    abstract void
    setLightingMode​(@Nullable LightingMode mode)
    Set the LightingMode to be used when setting blocks
    void
    Set the queue as having been modified now
    abstract void
    setModified​(long modified)
    Set when the queue was last modified
    abstract void
    setRegenRegion​(@NonNull com.sk89q.worldedit.regions.CuboidRegion regenRegion)
    Set the CuboidRegion designated for direct regeneration
    abstract boolean
    setTile​(int x, int y, int z, @NonNull com.sk89q.jnbt.CompoundTag tag)
    Sets a tile entity at the coordinates provided to the given CompoundTag
    abstract void
    setUnloadAfter​(boolean unloadAfter)
    Set whether chunks should be unloaded after being accessed
    abstract int
    Get the size of the queue in chunks
    abstract void
    Start the queue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QueueCoordinator

      public QueueCoordinator(@Nullable com.sk89q.worldedit.world.World world)
      Default constructor requires world to indicate any extents given to QueueCoordinator also need this constructor.
      Parameters:
      world - world as all queues should have this constructor
  • Method Details

    • getForChunk

      public ScopedQueueCoordinator getForChunk(int x, int z)
      Get a ScopedQueueCoordinator limited to the chunk at the specific chunk Coordinates
      Parameters:
      x - chunk x coordinate
      z - chunk z coordinate
      Returns:
      a new ScopedQueueCoordinator
    • size

      public abstract int size()
      Get the size of the queue in chunks
      Returns:
      size
    • setModified

      public abstract void setModified(long modified)
      Set when the queue was last modified
      Parameters:
      modified - long of system millis
    • isForceSync

      public boolean isForceSync()
      Returns true if the queue should be forced to be synchronous when enqueued.
      Returns:
      is force sync
    • setForceSync

      public void setForceSync(boolean forceSync)
      Set whether the queue should be forced to be synchronous
      Parameters:
      forceSync - force sync or not
    • getChunkObject

      public @Nullable Object getChunkObject()
      Get the Chunk Object set to the queue
      Returns:
      chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
    • setChunkObject

      public void setChunkObject(@NonNull Object chunkObject)
      Set a chunk object (e.g. the Bukkit Chunk object) to the queue
      Parameters:
      chunkObject - chunk object. Usually the implementation-specific chunk (e.g. bukkit Chunk)
    • setBlock

      public abstract 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.
      Parameters:
      x - the x coordinate from from 0 to 15 inclusive
      y - the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
      z - the z coordinate from 0 to 15 inclusive
      id - the BlockState to set the block to
      Returns:
      success or not
    • setBlock

      public abstract 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.
      Parameters:
      x - the x coordinate from from 0 to 15 inclusive
      y - the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
      z - the z coordinate from 0 to 15 inclusive
      id - 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.function.pattern.Pattern pattern)
      Sets the block at the coordinates provided to the given id.
      Parameters:
      x - the x coordinate from from 0 to 15 inclusive
      y - the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
      z - the z coordinate from 0 to 15 inclusive
      pattern - the pattern to set the block to
      Returns:
      success or not
    • setTile

      public abstract boolean setTile(int x, int y, int z, @NonNull com.sk89q.jnbt.CompoundTag tag)
      Sets a tile entity at the coordinates provided to the given CompoundTag
      Parameters:
      x - the x coordinate from from 0 to 15 inclusive
      y - the y coordinate from from 0 (inclusive) - maxHeight(exclusive)
      z - the z coordinate from 0 to 15 inclusive
      tag - the CompoundTag to set the tile to
      Returns:
      success or not
    • isSettingTiles

      public abstract boolean isSettingTiles()
      Whether the queue has any tiles being set
      Returns:
      if setting tiles
    • getBlock

      public abstract @Nullable com.sk89q.worldedit.world.block.BlockState getBlock(int x, int y, int z)
      Get a block at the given coordinates.
      Parameters:
      x - block x
      y - block y
      z - block z
      Returns:
      WorldEdit BlockState
    • setBiome

      @Deprecated(forRemoval=true) public abstract boolean setBiome(int x, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Biomes now take XYZ, see setBiome(int, int, int, BiomeType)
      Scheduled for removal once we drop the support for versions not supporting 3D biomes.
      Set a biome in XZ. This will likely set to the whole column
      Parameters:
      x - x coordinate
      z - z coordinate
      biome - biome
      Returns:
      success or not
    • setBiome

      public abstract boolean setBiome(int x, int y, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
      Set a biome in XYZ
      Parameters:
      x - x coordinate
      y - y coordinate
      z - z coordinate
      biome - biome
      Returns:
      success or not
    • isSettingBiomes

      public abstract boolean isSettingBiomes()
      Whether the queue has any biomes to be set
      Returns:
      if setting biomes
    • addEntities

      public void addEntities(@NonNull List<? extends com.sk89q.worldedit.entity.Entity> entities)
      Add entities to be created
      Parameters:
      entities - list of entities to add to queue
    • setEntity

      public abstract boolean setEntity(@NonNull com.sk89q.worldedit.entity.Entity entity)
      Add an entity to be created
      Parameters:
      entity - entity to add to queue
      Returns:
      success or not
    • getReadChunks

      public abstract @NonNull List<com.sk89q.worldedit.math.BlockVector2> 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

      public abstract void addReadChunks(@NonNull Set<com.sk89q.worldedit.math.BlockVector2> readChunks)
      Add a set of BlockVector2 Chunk coordinates to the Read Chunks list
      Parameters:
      readChunks - set of BlockVector2 to add to "read" chunks
    • addReadChunk

      public abstract void addReadChunk(@NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
      Add a BlockVector2 Chunk coordinate to the Read Chunks list
      Parameters:
      chunk - BlockVector2 to add to "read" chunks
    • isUnloadAfter

      public abstract boolean isUnloadAfter()
      Whether chunks should be unloaded after being accessed
      Returns:
      if is unloading chunks after accessing them
    • setUnloadAfter

      public abstract void setUnloadAfter(boolean unloadAfter)
      Set whether chunks should be unloaded after being accessed
      Parameters:
      unloadAfter - if to unload chunks after being accessed
    • getRegenRegion

      public abstract @Nullable com.sk89q.worldedit.regions.CuboidRegion getRegenRegion()
      Get the CuboidRegion designated for direct regeneration
      Returns:
      CuboidRegion to regenerate
    • setRegenRegion

      public abstract void setRegenRegion(@NonNull com.sk89q.worldedit.regions.CuboidRegion regenRegion)
      Set the CuboidRegion designated for direct regeneration
      Parameters:
      regenRegion - CuboidRegion to regenerate
    • regenChunk

      public abstract void regenChunk(int x, int z)
      Set a specific chunk at the chunk coordinates XZ to be regenerated.
      Parameters:
      x - chunk x
      z - chunk z
    • getWorld

      public abstract @Nullable com.sk89q.worldedit.world.World getWorld()
      Get the world the queue is writing to
      Returns:
      world of the queue
    • setModified

      public final void setModified()
      Set the queue as having been modified now
    • enqueue

      public boolean enqueue()
      Enqueue the queue to start it
      Returns:
      success or not
    • start

      public abstract void start()
      Start the queue
    • cancel

      public abstract void cancel()
      Cancel the queue
    • getCompleteTask

      public abstract Runnable getCompleteTask()
      Get the task to be run when all chunks have been accessed
      Returns:
      task to be run when queue is complete
    • setCompleteTask

      public abstract void setCompleteTask(@Nullable Runnable whenDone)
      Set the task to be run when all chunks have been accessed
      Parameters:
      whenDone - task to be run when queue is complete
    • getChunkConsumer

      public abstract @Nullable Consumer<com.sk89q.worldedit.math.BlockVector2> 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

      public abstract void setChunkConsumer(@NonNull Consumer<com.sk89q.worldedit.math.BlockVector2> consumer)
      Set the Consumer that will be executed on each chunk in queue
      Parameters:
      consumer - Consumer to be executed on each chunk in queue
    • addProgressSubscriber

      public abstract void addProgressSubscriber(@NonNull ProgressSubscriber progressSubscriber)
      Add a ProgressSubscriber to the Queue to subscribe to the relevant Chunk Processor
    • getLightingMode

      public abstract @NonNull LightingMode getLightingMode()
      Get the LightingMode to be used when setting blocks
    • setLightingMode

      public abstract void setLightingMode(@Nullable LightingMode mode)
      Set the LightingMode to be used when setting blocks
      Parameters:
      mode - lighting mode. Null to use default.
    • setCuboid

      public void setCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull com.sk89q.worldedit.world.block.BlockState block)
      Fill a cuboid between two positions with a BlockState
      Parameters:
      pos1 - 1st cuboid position
      pos2 - 2nd cuboid position
      block - block to fill
    • setCuboid

      public void setCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull com.sk89q.worldedit.function.pattern.Pattern blocks)
      Fill a cuboid between two positions with a Pattern
      Parameters:
      pos1 - 1st cuboid position
      pos2 - 2nd cuboid position
      blocks - pattern to fill
    • setBiomeCuboid

      public void setBiomeCuboid(@NonNull Location pos1, @NonNull Location pos2, @NonNull com.sk89q.worldedit.world.biome.BiomeType biome)
      Fill a cuboid between two positions with a BiomeType
      Parameters:
      pos1 - 1st cuboid position
      pos2 - 2nd cuboid position
      biome - biome to fill