From 6269c1e633d6736cacc75c0a55f56fbf182fea88 Mon Sep 17 00:00:00 2001 From: Andrew Ardill Date: Mon, 21 Feb 2011 12:28:35 +1100 Subject: [PATCH] implementation of isQueued() --- .../craftbukkit/scheduler/CraftScheduler.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 298c972455..334013a13d 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -223,4 +223,18 @@ public class CraftScheduler implements BukkitScheduler, Runnable { public boolean isCurrentlyRunning(int taskId){ return craftThreadManager.isAlive(taskId); } + + public boolean isQueued(int taskId) { + synchronized (schedulerQueue) { + Iterator itr = schedulerQueue.keySet().iterator(); + while (itr.hasNext()) { + CraftTask current = itr.next(); + if (current.getIdNumber() == taskId) { + return true; + } + } + return false; + } + } + }