summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsk89q <the.sk89q@gmail.com>2011-04-18 23:52:19 -0700
committersk89q <the.sk89q@gmail.com>2011-04-18 23:52:19 -0700
commitac9f297445a6116c5bb314b3be9f38520a58845e (patch)
tree8f75c92eb208c2211c7b621a068863cb92b331c0 /src/main
parenta450dcbb83e1c0172634c4cc6928d40641dedc85 (diff)
downloadcraftbukkit-ac9f297445a6116c5bb314b3be9f38520a58845e.tar
craftbukkit-ac9f297445a6116c5bb314b3be9f38520a58845e.tar.gz
craftbukkit-ac9f297445a6116c5bb314b3be9f38520a58845e.tar.lz
craftbukkit-ac9f297445a6116c5bb314b3be9f38520a58845e.tar.xz
craftbukkit-ac9f297445a6116c5bb314b3be9f38520a58845e.zip
Don't want the scheduler taking invalid arguments as well.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 664fe81d..ad07883a 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -168,6 +168,10 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
}
public int scheduleSyncRepeatingTask(Plugin plugin, Runnable task, long delay, long period) {
+ if (plugin == null) throw new IllegalArgumentException("Plugin can not null");
+ if (task == null) throw new IllegalArgumentException("Task can not null");
+ if (delay < 0) throw new IllegalArgumentException("Delay cannot be less than 0");
+
CraftTask newTask = new CraftTask(plugin, task, true, getCurrentTick()+delay, period);
synchronized (schedulerQueue) {
schedulerQueue.put(newTask, true);
@@ -185,6 +189,10 @@ public class CraftScheduler implements BukkitScheduler, Runnable {
}
public int scheduleAsyncRepeatingTask(Plugin plugin, Runnable task, long delay, long period) {
+ if (plugin == null) throw new IllegalArgumentException("Plugin can not null");
+ if (task == null) throw new IllegalArgumentException("Task can not null");
+ if (delay < 0) throw new IllegalArgumentException("Delay cannot be less than 0");
+
CraftTask newTask = new CraftTask(plugin, task, false, getCurrentTick()+delay, period);
synchronized (schedulerQueue) {
schedulerQueue.put(newTask, false);