java.lang.Object
io.github.thebusybiscuit.slimefun4.implementation.tasks.TickerTask
All Implemented Interfaces:
Runnable

public class TickerTask extends Object implements Runnable
The TickerTask is responsible for ticking every BlockTicker, synchronous or not.
Author:
TheBusyBiscuit
See Also:
  • Constructor Details

    • TickerTask

      public TickerTask()
  • Method Details

    • start

      public void start(@Nonnull Slimefun plugin)
      This method starts the TickerTask on an asynchronous schedule.
      Parameters:
      plugin - The instance of our Slimefun
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • isHalted

      public boolean isHalted()
    • halt

      public void halt()
    • queueMove

      @ParametersAreNonnullByDefault public void queueMove(Location from, Location to)
    • queueDelete

      @ParametersAreNonnullByDefault public void queueDelete(Location l, boolean destroy)
    • queueDelete

      @ParametersAreNonnullByDefault public void queueDelete(Collection<Location> locations, boolean destroy)
    • queueDelete

      @ParametersAreNonnullByDefault public void queueDelete(Map<Location,Boolean> locations)
    • isOccupiedSoon

      public boolean isOccupiedSoon(@Nonnull Location l)
      This method checks if the given Location has been reserved by this TickerTask. A reserved Location does not currently hold any data but will be occupied upon the next tick. Checking this ensures that our Location does not get treated like a normal Location as it is theoretically "moving".
      Parameters:
      l - The Location to check
      Returns:
      Whether this Location has been reserved and will be filled upon the next tick
    • isDeletedSoon

      public boolean isDeletedSoon(@Nonnull Location l)
      This method checks if a given Location will be deleted on the next tick.
      Parameters:
      l - The Location to check
      Returns:
      Whether this Location will be deleted on the next tick
    • getTickRate

      public int getTickRate()
      This returns the delay between ticks
      Returns:
      The tick delay
    • getLocations

      @Nonnull public Map<io.github.bakedlibs.dough.blocks.ChunkPosition,Set<Location>> getLocations()
      This method returns a read-only Map representation of every ChunkPosition and its corresponding Set of ticking Locations. This does include any Location from an unloaded Chunk too!
      Returns:
      A Map representation of all ticking Locations
    • getLocations

      @Nonnull public Set<Location> getLocations(@Nonnull Chunk chunk)
      This method returns a read-only Set of all ticking Locations in a given Chunk. The Chunk does not have to be loaded. If no Location is present, the returned Set will be empty.
      Parameters:
      chunk - The Chunk
      Returns:
      A Set of all ticking Locations
    • enableTicker

      public void enableTicker(@Nonnull Location l)
      This enables the ticker at the given Location and adds it to our "queue".
      Parameters:
      l - The Location to activate
    • disableTicker

      public void disableTicker(@Nonnull Location l)
      This method disables the ticker at the given Location and removes it from our internal "queue".
      Parameters:
      l - The Location to remove