diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index d50a036e63..edf5bae8d2 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -20,6 +20,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { private final CraftThreadManager craftThreadManager = new CraftThreadManager(); private final LinkedList mainThreadQueue = new LinkedList(); + private final LinkedList syncedTasks = new LinkedList(); private final TreeMap schedulerQueue = new TreeMap(); @@ -111,11 +112,14 @@ public class CraftScheduler implements BukkitScheduler, Runnable { try { this.currentTick = currentTick; while (!mainThreadQueue.isEmpty()) { - mainThreadQueue.removeFirst().run(); + syncedTasks.addLast(mainThreadQueue.removeFirst()); } } finally { mainThreadLock.unlock(); } + while(!syncedTasks.isEmpty()) { + syncedTasks.removeFirst().run(); + } } }