Class AsyncScheduler<T extends KarmaSource>

java.lang.Object
ml.karmaconfigs.api.common.timer.scheduler.Scheduler
ml.karmaconfigs.api.common.timer.worker.AsyncScheduler<T>
Type Parameters:
T - the karma plugin

public class AsyncScheduler<T extends KarmaSource> extends Scheduler
Bukkit special asynchronous scheduler
  • Constructor Details

    • AsyncScheduler

      public AsyncScheduler(T source)
      Initialize the scheduler
      Parameters:
      source - the scheduler owner
  • Method Details

    • onTaskStart

      public final void onTaskStart(Consumer<Integer> taskId)
      Action to perform when a task has been started
      Specified by:
      onTaskStart in class Scheduler
      Parameters:
      taskId - the action to perform
    • onTaskComplete

      public final void onTaskComplete(Consumer<Integer> taskId)
      Action to perform when a task has been completed
      Specified by:
      onTaskComplete in class Scheduler
      Parameters:
      taskId - the action to perform
    • queue

      public final int queue(Runnable task)
      Queue another task to the scheduler
      Specified by:
      queue in class Scheduler
      Parameters:
      task - the task to perform
      Returns:
      the task id
    • currentTask

      public final int currentTask()
      Get the current task id
      Specified by:
      currentTask in class Scheduler
      Returns:
      the current task id
    • hasMoreTasks

      public final boolean hasMoreTasks()
      Get if the scheduler has more tasks
      Returns:
      if the scheduler has more tasks