add isQueued() to allow plugins to know a task is still in the queue.
Currently, there is no way to know if a task is still being handled by the scheduler. This method, along with isCurrentlyRunning() allows a plugin author to determine if a task is waiting to be executed, being executed, or neither.
This commit is contained in:
parent
b2847fdf8c
commit
b93f044983
@ -105,17 +105,28 @@ public interface BukkitScheduler {
|
||||
public void cancelAllTasks();
|
||||
|
||||
/**
|
||||
* Is the task currently running.
|
||||
* Check if the task currently running.
|
||||
*
|
||||
* A repeating task might not be running currently, but will be running in the future.
|
||||
* A task that has finished, and does not repeat, will not be running ever again.
|
||||
*
|
||||
* Explicitly, a task is running if there exists a thread for it, and that thread is alive.
|
||||
*
|
||||
* @param taskId the task to check.
|
||||
* @param taskId The task to check.
|
||||
*
|
||||
* @return if the task is currently running.
|
||||
* @return If the task is currently running.
|
||||
*/
|
||||
public boolean isCurrentlyRunning(int taskId);
|
||||
|
||||
/**
|
||||
* Check if the task queued to be run later.
|
||||
*
|
||||
* If a repeating task is currently running, it might not be queued now but could be in the future.
|
||||
* A task that is not queued, and not running, will not be queued again.
|
||||
*
|
||||
* @param taskId The task to check.
|
||||
*
|
||||
* @return If the task is queued to be run.
|
||||
*/
|
||||
public boolean isQueued(int taskId);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user