Class ServerTask

java.lang.Object
emu.grasscutter.server.scheduler.ServerTask
All Implemented Interfaces:
Runnable

public final class ServerTask extends Object implements Runnable
This class works the same as a runnable, except with more information.
  • Constructor Details

    • ServerTask

      public ServerTask(Runnable runnable, int taskId, int period, int delay)
  • Method Details

    • cancel

      public void cancel()
      Cancels the task from running the next time.
    • shouldRun

      public boolean shouldRun()
      Checks if the task should run at the current tick.
      Returns:
      True if the task should run, false otherwise.
    • shouldCancel

      public boolean shouldCancel()
      Checks if the task should be canceled.
      Returns:
      True if the task should be canceled, false otherwise.
    • run

      public void run()
      Runs the task.
      Specified by:
      run in interface Runnable
    • getTaskId

      public int getTaskId()
    • getTicks

      public int getTicks()