Allows calling of functions in the main thread

By: Raphfrk <raphfrk@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-02-12 00:03:41 +00:00
parent 7b32aee768
commit 3274723ced

View file

@ -1,6 +1,8 @@
package org.bukkit.scheduler;
import org.bukkit.plugin.Plugin;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
public interface BukkitScheduler {
@ -70,6 +72,19 @@ public interface BukkitScheduler {
*/
public int scheduleAsyncRepeatingTask(Plugin plugin, Runnable task, long delay, long period);
/**
* Calls a method on the main thread and returns a Future object
* This task will be executed by the main server thread
*
* Note: The Future.get() methods must NOT be called from the main thread
* Note2: There is at least an average of 10ms latency until the isDone() method returns true
*
* @param Plugin Plugin that owns the task
* @param Callable Task to be executed
* @return Future Future object related to the task
*/
public <T> Future<T> callSyncMethod(Plugin plugin, Callable<T> task);
/**
* Removes task from scheduler
*