java.lang.Object
net.lucypoulton.squirtgun.platform.scheduler.Task

public class Task extends Object
A task that can be run. It can be scheduled to run later, or to repeat itself, and it may be asynchronous.
  • Method Details

    • builder

      public static Task.Builder builder()
    • builder

      public static Task.Builder builder(Consumer<Platform> action)
    • builder

      public static Task.Builder builder(Runnable action)
    • isRepeating

      public boolean isRepeating()
      Whether this task is repeating.
    • getDelay

      public int getDelay()
      How long to wait before executing this task.
    • getInterval

      public int getInterval()
      How many ticks to wait between executing repeatedly, or -1 if it should not repeat.
    • execute

      public void execute(Platform platform)
      Executes this task.
    • isAsync

      public boolean isAsync()
      Whether this task should be run asynchronously.
    • getId

      public long getId()
      Get the numeric ID assigned to this task.

      Task IDs are auto-incremental and unique.

      Returns:
      the task ID
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object