|
|
|
|
@@ -1,6 +1,8 @@
|
|
|
|
|
package org.bukkit.scheduler;
|
|
|
|
|
|
|
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
|
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -18,7 +20,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @param delay Delay in server ticks before executing task
|
|
|
|
|
* @return Task id number (-1 if scheduling failed)
|
|
|
|
|
*/
|
|
|
|
|
public int scheduleSyncDelayedTask(Plugin plugin, Runnable task, long delay);
|
|
|
|
|
public int scheduleSyncDelayedTask(@NotNull Plugin plugin, @NotNull Runnable task, long delay);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskLater(Plugin, long)}
|
|
|
|
|
@@ -28,7 +30,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @return Task id number (-1 if scheduling failed)
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public int scheduleSyncDelayedTask(Plugin plugin, BukkitRunnable task, long delay);
|
|
|
|
|
public int scheduleSyncDelayedTask(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Schedules a once off task to occur as soon as possible.
|
|
|
|
|
@@ -39,7 +41,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @param task Task to be executed
|
|
|
|
|
* @return Task id number (-1 if scheduling failed)
|
|
|
|
|
*/
|
|
|
|
|
public int scheduleSyncDelayedTask(Plugin plugin, Runnable task);
|
|
|
|
|
public int scheduleSyncDelayedTask(@NotNull Plugin plugin, @NotNull Runnable task);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTask(Plugin)}
|
|
|
|
|
@@ -48,7 +50,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @return Task id number (-1 if scheduling failed)
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public int scheduleSyncDelayedTask(Plugin plugin, BukkitRunnable task);
|
|
|
|
|
public int scheduleSyncDelayedTask(@NotNull Plugin plugin, @NotNull BukkitRunnable task);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Schedules a repeating task.
|
|
|
|
|
@@ -61,7 +63,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @param period Period in server ticks of the task
|
|
|
|
|
* @return Task id number (-1 if scheduling failed)
|
|
|
|
|
*/
|
|
|
|
|
public int scheduleSyncRepeatingTask(Plugin plugin, Runnable task, long delay, long period);
|
|
|
|
|
public int scheduleSyncRepeatingTask(@NotNull Plugin plugin, @NotNull Runnable task, long delay, long period);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskTimer(Plugin, long, long)}
|
|
|
|
|
@@ -72,7 +74,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @return Task id number (-1 if scheduling failed)
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public int scheduleSyncRepeatingTask(Plugin plugin, BukkitRunnable task, long delay, long period);
|
|
|
|
|
public int scheduleSyncRepeatingTask(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -89,7 +91,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* task, but rather, "an async" task
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public int scheduleAsyncDelayedTask(Plugin plugin, Runnable task, long delay);
|
|
|
|
|
public int scheduleAsyncDelayedTask(@NotNull Plugin plugin, @NotNull Runnable task, long delay);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -105,7 +107,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* task, but rather, "an async" task
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public int scheduleAsyncDelayedTask(Plugin plugin, Runnable task);
|
|
|
|
|
public int scheduleAsyncDelayedTask(@NotNull Plugin plugin, @NotNull Runnable task);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -123,7 +125,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* task, but rather, "an async" task
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public int scheduleAsyncRepeatingTask(Plugin plugin, Runnable task, long delay, long period);
|
|
|
|
|
public int scheduleAsyncRepeatingTask(@NotNull Plugin plugin, @NotNull Runnable task, long delay, long period);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Calls a method on the main thread and returns a Future object. This
|
|
|
|
|
@@ -139,7 +141,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @param task Task to be executed
|
|
|
|
|
* @return Future Future object related to the task
|
|
|
|
|
*/
|
|
|
|
|
public <T> Future<T> callSyncMethod(Plugin plugin, Callable<T> task);
|
|
|
|
|
@NotNull
|
|
|
|
|
public <T> Future<T> callSyncMethod(@NotNull Plugin plugin, @NotNull Callable<T> task);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes task from scheduler.
|
|
|
|
|
@@ -154,7 +157,7 @@ public interface BukkitScheduler {
|
|
|
|
|
*
|
|
|
|
|
* @param plugin Owner of tasks to be removed
|
|
|
|
|
*/
|
|
|
|
|
public void cancelTasks(Plugin plugin);
|
|
|
|
|
public void cancelTasks(@NotNull Plugin plugin);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if the task currently running.
|
|
|
|
|
@@ -193,6 +196,7 @@ public interface BukkitScheduler {
|
|
|
|
|
*
|
|
|
|
|
* @return Active workers
|
|
|
|
|
*/
|
|
|
|
|
@NotNull
|
|
|
|
|
public List<BukkitWorker> getActiveWorkers();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -201,6 +205,7 @@ public interface BukkitScheduler {
|
|
|
|
|
*
|
|
|
|
|
* @return Active workers
|
|
|
|
|
*/
|
|
|
|
|
@NotNull
|
|
|
|
|
public List<BukkitTask> getPendingTasks();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -212,7 +217,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public BukkitTask runTask(Plugin plugin, Runnable task) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTask(@NotNull Plugin plugin, @NotNull Runnable task) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a task that will run on the next server tick.
|
|
|
|
|
@@ -222,7 +228,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public void runTask(Plugin plugin, Consumer<BukkitTask> task) throws IllegalArgumentException;
|
|
|
|
|
public void runTask(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTask(Plugin)}
|
|
|
|
|
@@ -234,7 +240,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BukkitTask runTask(Plugin plugin, BukkitRunnable task) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTask(@NotNull Plugin plugin, @NotNull BukkitRunnable task) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -248,7 +255,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public BukkitTask runTaskAsynchronously(Plugin plugin, Runnable task) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Runnable task) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -261,7 +269,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public void runTaskAsynchronously(Plugin plugin, Consumer<BukkitTask> task) throws IllegalArgumentException;
|
|
|
|
|
public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskAsynchronously(Plugin)}
|
|
|
|
|
@@ -272,7 +280,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BukkitTask runTaskAsynchronously(Plugin plugin, BukkitRunnable task) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a task that will run after the specified number of server
|
|
|
|
|
@@ -285,7 +294,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public BukkitTask runTaskLater(Plugin plugin, Runnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskLater(@NotNull Plugin plugin, @NotNull Runnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a task that will run after the specified number of server
|
|
|
|
|
@@ -297,7 +307,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public void runTaskLater(Plugin plugin, Consumer<BukkitTask> task, long delay) throws IllegalArgumentException;
|
|
|
|
|
public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskLater(Plugin, long)}
|
|
|
|
|
@@ -309,7 +319,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BukkitTask runTaskLater(Plugin plugin, BukkitRunnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskLater(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -325,7 +336,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public BukkitTask runTaskLaterAsynchronously(Plugin plugin, Runnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Runnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -340,7 +352,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public void runTaskLaterAsynchronously(Plugin plugin, Consumer<BukkitTask> task, long delay) throws IllegalArgumentException;
|
|
|
|
|
public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskLaterAsynchronously(Plugin, long)}
|
|
|
|
|
@@ -352,7 +364,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BukkitTask runTaskLaterAsynchronously(Plugin plugin, BukkitRunnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a task that will repeatedly run until cancelled, starting after
|
|
|
|
|
@@ -366,7 +379,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public BukkitTask runTaskTimer(Plugin plugin, Runnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskTimer(@NotNull Plugin plugin, @NotNull Runnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns a task that will repeatedly run until cancelled, starting after
|
|
|
|
|
@@ -379,7 +393,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public void runTaskTimer(Plugin plugin, Consumer<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskTimer(Plugin, long, long)}
|
|
|
|
|
@@ -392,7 +406,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BukkitTask runTaskTimer(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskTimer(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -410,7 +425,8 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Runnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Runnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
|
|
|
|
@@ -427,7 +443,7 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if plugin is null
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
public void runTaskTimerAsynchronously(Plugin plugin, Consumer<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @deprecated Use {@link BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)}
|
|
|
|
|
@@ -441,5 +457,6 @@ public interface BukkitScheduler {
|
|
|
|
|
* @throws IllegalArgumentException if task is null
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
@NotNull
|
|
|
|
|
public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull BukkitRunnable task, long delay, long period) throws IllegalArgumentException;
|
|
|
|
|
}
|
|
|
|
|
|