Class TaskSubscription<T extends Task>

java.lang.Object
me.totalfreedom.service.TaskSubscription<T>
Type Parameters:
T - The type of task.

public final class TaskSubscription<T extends Task> extends Object
Represents a subscription to a task. Task subscriptions offer a nice wrapper for managing tasks, which are inevitably just bukkit runnables with a bit more lenience in terms of instantiation modification and execution. It also offers a more intuitive way to manage our tasks; rather than having to keep track of task ids for each BukkitTask object that gets returned by the BukkitScheduler.
  • Method Details

    • start

      public void start()
      Starts the task.
    • stop

      public void stop()
      Stops the task.
    • getTaskId

      public int getTaskId()
      Returns:
      The task id of the task.
    • getTask

      public T getTask()
      Returns:
      The task that is being subscribed to.
    • isAsync

      public boolean isAsync()
      Returns:
      True if the task is async, false otherwise.
    • getExecutor

      public Executor getExecutor()
      Returns:
      The executor that will execute the task.
    • isActive

      public boolean isActive()
      Returns:
      True if the task is active, false otherwise.