Interface Tickable

All Known Subinterfaces:
Emitter
All Known Implementing Classes:
AbstractEmitter, DisplayEntityEmitter, ParticleEmitter, TransformTree

public interface Tickable
Something that wants to be driven once per tick by a TickManager. Implementations should return true from tick() when they are finished, so the manager can remove and clean them up.

On Folia, the manager schedules per-region tasks based on getTickLocation(), so it must return a non-null location. On non-Folia servers the location is ignored.

  • Method Summary

    Modifier and Type
    Method
    Description
    default @Nullable org.bukkit.Location
    The location used by TickManager implementations to choose a region for scheduling.
    default void
    Cleanup hook.
    boolean
    Performs one tick of work.
  • Method Details

    • tick

      boolean tick()
      Performs one tick of work. Return true when finished; the manager will cancel and call remove().
      Returns:
      true to stop ticking.
    • getTickLocation

      @Nullable default @Nullable org.bukkit.Location getTickLocation()
      The location used by TickManager implementations to choose a region for scheduling. Must return non-null on Folia.
      Returns:
      The location, or null if region-agnostic (non-Folia only).
    • remove

      default void remove()
      Cleanup hook. Called by the TickManager when tick() returns true, or during TickManager.shutdown(). Default is a no-op.