Class Task

java.lang.Object
redempt.redlib.misc.Task

public class Task extends Object
Simple utility for Bukkit scheduler tasks, essentially just shorthand
  • Method Details

    • syncDelayed

      public static Task syncDelayed(Runnable run)
      Schedules a sync delayed task to run as soon as possible
      Parameters:
      run - The task to run
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(org.bukkit.plugin.Plugin plugin, Runnable run)
      Schedules a sync delayed task to run as soon as possible
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(Consumer<Task> run)
      Schedules a sync delayed task to run as soon as possible
      Parameters:
      run - The task to run
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(org.bukkit.plugin.Plugin plugin, Consumer<Task> run)
      Schedules a sync delayed task to run as soon as possible
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(Runnable run, long delay)
      Schedules a sync delayed task to run after a delay
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(org.bukkit.plugin.Plugin plugin, Runnable run, long delay)
      Schedules a sync delayed task to run after a delay
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(Consumer<Task> run, long delay)
      Schedules a sync delayed task to run after a delay
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • syncDelayed

      public static Task syncDelayed(org.bukkit.plugin.Plugin plugin, Consumer<Task> run, long delay)
      Schedules a sync delayed task to run after a delay
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • syncRepeating

      public static Task syncRepeating(Runnable run, long delay, long period)
      Schedules a sync repeating task to run later
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • syncRepeating

      public static Task syncRepeating(org.bukkit.plugin.Plugin plugin, Runnable run, long delay, long period)
      Schedules a sync repeating task to run later
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • syncRepeating

      public static Task syncRepeating(Consumer<Task> run, long delay, long period)
      Schedules a sync repeating task to run later
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • syncRepeating

      public static Task syncRepeating(org.bukkit.plugin.Plugin plugin, Consumer<Task> run, long delay, long period)
      Schedules a sync repeating task to run later
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(Runnable run)
      Schedules an async delayed task to run as soon as possible
      Parameters:
      run - The task to run
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(org.bukkit.plugin.Plugin plugin, Runnable run)
      Schedules an async delayed task to run as soon as possible
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(Consumer<Task> run)
      Schedules an async delayed task to run as soon as possible
      Parameters:
      run - The task to run
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(org.bukkit.plugin.Plugin plugin, Consumer<Task> run)
      Schedules an async delayed task to run as soon as possible
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(Runnable run, long delay)
      Schedules an async delayed task to run after a delay
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(org.bukkit.plugin.Plugin plugin, Runnable run, long delay)
      Schedules an async delayed task to run after a delay
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(Consumer<Task> run, long delay)
      Schedules an async delayed task to run after a delay
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      public static Task asyncDelayed(org.bukkit.plugin.Plugin plugin, Consumer<Task> run, long delay)
      Schedules an async delayed task to run after a delay
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      public static Task asyncRepeating(Consumer<Task> run, long delay, long period)
      Schedules an async repeating task to run later
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      public static Task asyncRepeating(org.bukkit.plugin.Plugin plugin, Consumer<Task> run, long delay, long period)
      Schedules an async repeating task to run later
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      public static Task asyncRepeating(Runnable run, long delay, long period)
      Schedules an async repeating task to run later
      Parameters:
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      public static Task asyncRepeating(org.bukkit.plugin.Plugin plugin, Runnable run, long delay, long period)
      Schedules an async repeating task to run later
      Parameters:
      plugin - The plugin scheduling the task
      run - The task to run
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      Returns:
      The Task that has been scheduled
    • getType

      public Task.TaskType getType()
      Returns:
      The type of this Task
    • isQueued

      public boolean isQueued()
      Returns:
      Whether this Task is queued, same as BukkitScheduler.isQueued(int)
    • isCurrentlyRunning

      public boolean isCurrentlyRunning()
      Returns:
      Whether this Task is currently running, same as BukkitScheduler.isCurrentlyRunning(int)
    • cancel

      public void cancel()
      Cancels this task, same as BukkitScheduler.cancelTask(int)
    • getPlugin

      public org.bukkit.plugin.Plugin getPlugin()
      Returns:
      The Plugin which scheduled this task