Class Task

java.lang.Object
com.marcusslover.plus.lib.task.Task

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

    • syncDelayed

      @Deprecated public static Task syncDelayed(Runnable run)
      Deprecated.
      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 - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • syncDelayed

      @Deprecated public static Task syncDelayed(Consumer<Task> run)
      Deprecated.
      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 - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • syncDelayed

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

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

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

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

      @Deprecated public static Task syncRepeating(long delay, long period, Runnable run)
      Deprecated.
      Schedules a sync repeating task to run later
      Parameters:
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      run - The task to run - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • syncRepeating

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

      @Deprecated public static Task syncRepeating(long delay, long period, Consumer<Task> run)
      Deprecated.
      Schedules a sync repeating task to run later
      Parameters:
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      run - The task to run - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • syncRepeating

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

      @Deprecated public static Task asyncDelayed(Runnable run)
      Deprecated.
      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 - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • asyncDelayed

      @Deprecated public static Task asyncDelayed(Consumer<Task> run)
      Deprecated.
      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 - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • asyncDelayed

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

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

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

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

      @Deprecated public static Task asyncRepeating(long delay, long period, Consumer<Task> run)
      Deprecated.
      Schedules an async repeating task to run later
      Parameters:
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      run - The task to run - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      @Deprecated(forRemoval=true) public static Task asyncRepeating(org.bukkit.plugin.Plugin plugin, long delay, long period, Consumer<Task> run)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Schedules an async repeating task to run later
      Parameters:
      plugin - The plugin scheduling the task
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      run - The task to run - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      @Deprecated public static Task asyncRepeating(long delay, long period, Runnable run)
      Deprecated.
      Schedules an async repeating task to run later
      Parameters:
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      run - The task to run - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • asyncRepeating

      public static Task asyncRepeating(org.bukkit.plugin.Plugin plugin, long delay, long period, Runnable run)
      Schedules an async repeating task to run later
      Parameters:
      plugin - The plugin scheduling the task
      delay - The delay in ticks to wait before running the task
      period - The number of ticks between executions of the task
      run - The task to run - Do not use bukkit runnable. (Cancelling the bukkit runnable will not cancel the created task)
      Returns:
      The Task that has been scheduled
    • 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)