Class BasicQueueCoordinator

java.lang.Object
com.plotsquared.core.queue.QueueCoordinator
com.plotsquared.core.queue.BasicQueueCoordinator

public abstract class BasicQueueCoordinator extends QueueCoordinator
Standard block setting queue that allows block setting across numerous chunks, without limits.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BasicQueueCoordinator​(@NonNull com.sk89q.worldedit.world.World world)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addProgressSubscriber​(@NonNull ProgressSubscriber progressSubscriber)
    Add a ProgressSubscriber to the Queue to subscribe to the relevant Chunk Processor
    void
    addReadChunk​(@NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
    Add a BlockVector2 Chunk coordinate to the Read Chunks list
    void
    addReadChunks​(@NonNull Set<com.sk89q.worldedit.math.BlockVector2> readRegion)
    Add a set of BlockVector2 Chunk coordinates to the Read Chunks list
    abstract com.sk89q.worldedit.world.block.BlockState
    getBlock​(int x, int y, int z)
    Get a block at the given coordinates.
    @NonNull ConcurrentHashMap<com.sk89q.worldedit.math.BlockVector2,​LocalChunk>
    Gets the map of ChunkCoordinates in BlockVector2 form against the LocalChunk of cached chunks to be written
    @Nullable Consumer<com.sk89q.worldedit.math.BlockVector2>
    Return the chunk consumer set to the queue or null if one is not set
    Get the task to be run when all chunks have been accessed
    @NonNull LightingMode
    Get the LightingMode to be used when setting blocks
    Get the list of progress subscribers currently added to the queue to be added to the Chunk Coordinator
    @NonNull List<com.sk89q.worldedit.math.BlockVector2>
    Get the list of chunks that are added manually.
    int[]
    Gets the int[x,z] chunk coordinates where regeneration should finish
    com.sk89q.worldedit.regions.CuboidRegion
    Get the CuboidRegion designated for direct regeneration
    int[]
    Gets the int[x,z] chunk coordinates where regeneration should start from
    @NonNull com.sk89q.worldedit.world.World
    Get the world the queue is writing to
    boolean
    Whether the queue has a start/end to chunk regeneration
    boolean
    Whether the queue has any biomes to be set
    boolean
    Whether the queue has any tiles being set
    boolean
    Whether chunks should be unloaded after being accessed
    void
    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 biomeType)
    Set a biome in XYZ
    boolean
    setBiome​(int x, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biomeType)
    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
    setChunk​(@NonNull LocalChunk chunk)
    Forces an LocalChunk into the list of chunks to be written.
    void
    setChunkConsumer​(@NonNull Consumer<com.sk89q.worldedit.math.BlockVector2> consumer)
    Set the Consumer that will be executed on each chunk in queue
    void
    Set the task to be run when all chunks have been accessed
    boolean
    setEntity​(@NonNull com.sk89q.worldedit.entity.Entity entity)
    Add an entity to be created
    void
    setLightingMode​(@Nullable LightingMode mode)
    Set the LightingMode to be used when setting blocks
    void
    setModified​(long modified)
    Set when the queue was last modified
    void
    setRegenRegion​(@NonNull com.sk89q.worldedit.regions.CuboidRegion regenRegion)
    Set the CuboidRegion designated for direct regeneration
    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
    void
    setUnloadAfter​(boolean unloadAfter)
    Set whether chunks should be unloaded after being accessed
    int
    Get the size of the queue in chunks

    Methods inherited from class java.lang.Object

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

    • BasicQueueCoordinator

      public BasicQueueCoordinator(@NonNull com.sk89q.worldedit.world.World world)
  • Method Details

    • getBlock

      public abstract 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 class QueueCoordinator
      Parameters:
      x - block x
      y - block y
      z - block z
      Returns:
      WorldEdit BlockState
    • getWorld

      public final @NonNull com.sk89q.worldedit.world.World getWorld()
      Description copied from class: QueueCoordinator
      Get the world the queue is writing to
      Specified by:
      getWorld in class QueueCoordinator
      Returns:
      world of the queue
    • size

      public final int size()
      Description copied from class: QueueCoordinator
      Get the size of the queue in chunks
      Specified by:
      size in class QueueCoordinator
      Returns:
      size
    • setModified

      public final void setModified(long modified)
      Description copied from class: QueueCoordinator
      Set when the queue was last modified
      Specified by:
      setModified in class QueueCoordinator
      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 class QueueCoordinator
      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
    • 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 class QueueCoordinator
      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.world.block.BlockState id)
      Description copied from class: QueueCoordinator
      Sets the block at the coordinates provided to the given id.
      Specified by:
      setBlock in class QueueCoordinator
      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
    • setBiome

      public boolean setBiome(int x, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biomeType)
      Description copied from class: QueueCoordinator
      Set a biome in XZ. This will likely set to the whole column
      Specified by:
      setBiome in class QueueCoordinator
      Parameters:
      x - x coordinate
      z - z coordinate
      biomeType - biome
      Returns:
      success or not
    • setBiome

      public final boolean setBiome(int x, int y, int z, @NonNull com.sk89q.worldedit.world.biome.BiomeType biomeType)
      Description copied from class: QueueCoordinator
      Set a biome in XYZ
      Specified by:
      setBiome in class QueueCoordinator
      Parameters:
      x - x coordinate
      y - y coordinate
      z - z coordinate
      biomeType - 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 class QueueCoordinator
      Returns:
      if setting biomes
    • 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 class QueueCoordinator
      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 boolean isSettingTiles()
      Description copied from class: QueueCoordinator
      Whether the queue has any tiles being set
      Specified by:
      isSettingTiles in class QueueCoordinator
      Returns:
      if setting tiles
    • 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 class QueueCoordinator
      Parameters:
      entity - entity to add to queue
      Returns:
      success or not
    • getReadChunks

      public @NonNull List<com.sk89q.worldedit.math.BlockVector2> 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 class QueueCoordinator
      Returns:
      list of BlockVector2 of chunks that are to be "read"
    • addReadChunk

      public void addReadChunk(@NonNull com.sk89q.worldedit.math.BlockVector2 chunk)
      Description copied from class: QueueCoordinator
      Add a BlockVector2 Chunk coordinate to the Read Chunks list
      Specified by:
      addReadChunk in class QueueCoordinator
      Parameters:
      chunk - BlockVector2 to add to "read" chunks
    • addReadChunks

      public void addReadChunks(@NonNull Set<com.sk89q.worldedit.math.BlockVector2> readRegion)
      Description copied from class: QueueCoordinator
      Add a set of BlockVector2 Chunk coordinates to the Read Chunks list
      Specified by:
      addReadChunks in class QueueCoordinator
      Parameters:
      readRegion - set of BlockVector2 to add to "read" chunks
    • getRegenRegion

      public com.sk89q.worldedit.regions.CuboidRegion getRegenRegion()
      Description copied from class: QueueCoordinator
      Get the CuboidRegion designated for direct regeneration
      Specified by:
      getRegenRegion in class QueueCoordinator
      Returns:
      CuboidRegion to regenerate
    • setRegenRegion

      public void setRegenRegion(@NonNull com.sk89q.worldedit.regions.CuboidRegion regenRegion)
      Description copied from class: QueueCoordinator
      Set the CuboidRegion designated for direct regeneration
      Specified by:
      setRegenRegion in class QueueCoordinator
      Parameters:
      regenRegion - CuboidRegion to regenerate
    • 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 class QueueCoordinator
      Parameters:
      x - chunk x
      z - chunk z
    • isUnloadAfter

      public boolean isUnloadAfter()
      Description copied from class: QueueCoordinator
      Whether chunks should be unloaded after being accessed
      Specified by:
      isUnloadAfter in class QueueCoordinator
      Returns:
      if is unloading chunks after accessing them
    • setUnloadAfter

      public void setUnloadAfter(boolean unloadAfter)
      Description copied from class: QueueCoordinator
      Set whether chunks should be unloaded after being accessed
      Specified by:
      setUnloadAfter in class QueueCoordinator
      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

      public @NonNull ConcurrentHashMap<com.sk89q.worldedit.math.BlockVector2,​LocalChunk> getBlockChunks()
      Gets the map of ChunkCoordinates in BlockVector2 form against the LocalChunk of cached chunks to be written
      Returns:
      ConcurrentHashMap of chunks to be accessed
    • setChunk

      public final void setChunk(@NonNull LocalChunk chunk)
      Forces an LocalChunk into 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

      public final @Nullable Consumer<com.sk89q.worldedit.math.BlockVector2> 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 class QueueCoordinator
      Returns:
      Consumer to be executed on each chunk in queue
    • setChunkConsumer

      public final void setChunkConsumer(@NonNull Consumer<com.sk89q.worldedit.math.BlockVector2> consumer)
      Description copied from class: QueueCoordinator
      Set the Consumer that will be executed on each chunk in queue
      Specified by:
      setChunkConsumer in class QueueCoordinator
      Parameters:
      consumer - Consumer to be executed on each chunk in queue
    • getProgressSubscribers

      public final List<ProgressSubscriber> getProgressSubscribers()
      Get the list of progress subscribers currently added to the queue to be added to the Chunk Coordinator
    • addProgressSubscriber

      public final void addProgressSubscriber(@NonNull ProgressSubscriber progressSubscriber)
      Description copied from class: QueueCoordinator
      Add a ProgressSubscriber to the Queue to subscribe to the relevant Chunk Processor
      Specified by:
      addProgressSubscriber in class QueueCoordinator
    • getLightingMode

      public final @NonNull LightingMode getLightingMode()
      Description copied from class: QueueCoordinator
      Get the LightingMode to be used when setting blocks
      Specified by:
      getLightingMode in class QueueCoordinator
    • setLightingMode

      public final void setLightingMode(@Nullable LightingMode mode)
      Description copied from class: QueueCoordinator
      Set the LightingMode to be used when setting blocks
      Specified by:
      setLightingMode in class QueueCoordinator
      Parameters:
      mode - lighting mode. Null to use default.
    • getCompleteTask

      public Runnable getCompleteTask()
      Description copied from class: QueueCoordinator
      Get the task to be run when all chunks have been accessed
      Specified by:
      getCompleteTask in class QueueCoordinator
      Returns:
      task to be run when queue is complete
    • setCompleteTask

      public void setCompleteTask(Runnable whenDone)
      Description copied from class: QueueCoordinator
      Set the task to be run when all chunks have been accessed
      Specified by:
      setCompleteTask in class QueueCoordinator
      Parameters:
      whenDone - task to be run when queue is complete