From a564d4c7f19537ddaee4727fa2261e43eed4b4de Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 21 Mar 2013 13:35:35 +1100 Subject: [PATCH] Fix issue #219 - make the scheduler work --- .../java/net/md_5/bungee/scheduler/BungeeScheduler.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeScheduler.java b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeScheduler.java index 703b7731..9fd001df 100644 --- a/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeScheduler.java +++ b/proxy/src/main/java/net/md_5/bungee/scheduler/BungeeScheduler.java @@ -68,7 +68,10 @@ public class BungeeScheduler implements TaskScheduler private BungeeTask prepare(Plugin owner, Runnable task) { - int id = taskCounter.getAndIncrement(); - return tasks.put( id, new BungeeTask( taskCounter.getAndIncrement(), owner, task ) ); + Preconditions.checkNotNull( owner, "owner" ); + Preconditions.checkNotNull( task, "task" ); + BungeeTask prepared = new BungeeTask( taskCounter.getAndIncrement(), owner, task ); + tasks.put( prepared.getId(), prepared ); + return prepared; } }