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 Details

    • BasicQueueCoordinator

      public BasicQueueCoordinator(@NonNull World world)
  • Method Details

    • getBlock

      public abstract 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 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 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 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 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 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 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 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 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<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 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<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 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 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

      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<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<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