Class Task

java.lang.Object
org.cloudburstmc.server.scheduler.Task
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
PluginTask

public abstract class Task extends Object implements Runnable
Represents a task being executed by the ServerScheduler. For plugin developers: To make sure your task will only be executed in the case of safety (such as: prevent this task from running if its owner plugin is disabled), it's suggested to use PluginTask instead of extend this class.
  • Constructor Details

    • Task

      public Task()
  • Method Details

    • getHandler

      public final TaskHandler getHandler()
    • getTaskId

      public final int getTaskId()
    • setHandler

      public final void setHandler(TaskHandler taskHandler)
    • onRun

      public abstract void onRun(int currentTick)
      The method called when a task is executed.
      Parameters:
      currentTick - The elapsed tick count from the server is started. 20 ticks = 1 second, 1 tick = 0.05 seconds
    • run

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

      public void onCancel()
    • cancel

      public void cancel()