From e345a982eb7011e14c12538f6e1118cca18cf54b Mon Sep 17 00:00:00 2001 From: Andrew Ardill Date: Mon, 14 Feb 2011 15:31:21 +1100 Subject: [PATCH] add function isCurrentlyRunning(int taskId); returns if the given task is currently running. --- .../java/org/bukkit/scheduler/BukkitScheduler.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java index 08062f34..350a5bed 100644 --- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java @@ -104,4 +104,18 @@ public interface BukkitScheduler { */ public void cancelAllTasks(); + /** + * Is 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. + * + * @return if the task is currently running. + */ + public boolean isCurrentlyRunning(int taskId); + }