From b93f04498357187e63c3123e4196dea478403c53 Mon Sep 17 00:00:00 2001 From: Andrew Ardill Date: Mon, 21 Feb 2011 12:33:40 +1100 Subject: [PATCH] add isQueued() to allow plugins to know a task is still in the queue. Currently, there is no way to know if a task is still being handled by the scheduler. This method, along with isCurrentlyRunning() allows a plugin author to determine if a task is waiting to be executed, being executed, or neither. --- .../org/bukkit/scheduler/BukkitScheduler.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java index 350a5bed..67ec06f7 100644 --- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java @@ -105,17 +105,28 @@ public interface BukkitScheduler { public void cancelAllTasks(); /** - * Is the task currently running. + * Check if the task currently running. * * A repeating task might not be running currently, but will be running in the future. * A task that has finished, and does not repeat, will not be running ever again. * * Explicitly, a task is running if there exists a thread for it, and that thread is alive. * - * @param taskId the task to check. + * @param taskId The task to check. * - * @return if the task is currently running. + * @return If the task is currently running. */ public boolean isCurrentlyRunning(int taskId); + /** + * Check if the task queued to be run later. + * + * If a repeating task is currently running, it might not be queued now but could be in the future. + * A task that is not queued, and not running, will not be queued again. + * + * @param taskId The task to check. + * + * @return If the task is queued to be run. + */ + public boolean isQueued(int taskId); }