Bukkit  1.6.4-R2.0
 All Classes Namespaces Files Functions Variables Enumerator Pages
org.bukkit.scheduler.BukkitScheduler Interface Reference

Public Member Functions

int scheduleSyncDelayedTask (Plugin plugin, Runnable task, long delay)
 Schedules a once off task to occur after a delay.
 
int scheduleSyncDelayedTask (Plugin plugin, Runnable task)
 Schedules a once off task to occur as soon as possible.
 
int scheduleSyncRepeatingTask (Plugin plugin, Runnable task, long delay, long period)
 Schedules a repeating task.
 
int scheduleAsyncDelayedTask (Plugin plugin, Runnable task, long delay)
 Asynchronous tasks should never access any API in Bukkit.
 
int scheduleAsyncDelayedTask (Plugin plugin, Runnable task)
 Asynchronous tasks should never access any API in Bukkit.
 
int scheduleAsyncRepeatingTask (Plugin plugin, Runnable task, long delay, long period)
 Asynchronous tasks should never access any API in Bukkit.
 
public< T > Future< T > callSyncMethod (Plugin plugin, Callable< T > task)
 Calls a method on the main thread and returns a Future object This task will be executed by the main server thread.
 
void cancelTask (int taskId)
 Removes task from scheduler.
 
void cancelTasks (Plugin plugin)
 Removes all tasks associated with a particular plugin from the scheduler.
 
void cancelAllTasks ()
 Removes all tasks from the scheduler.
 
boolean isCurrentlyRunning (int taskId)
 Check if the task currently running.
 
boolean isQueued (int taskId)
 Check if the task queued to be run later.
 
List< BukkitWorkergetActiveWorkers ()
 Returns a list of all active workers.
 
List< BukkitTaskgetPendingTasks ()
 Returns a list of all pending tasks.
 
BukkitTask runTask (Plugin plugin, Runnable task) throws IllegalArgumentException
 Returns a task that will run on the next server tick.
 
BukkitTask runTaskAsynchronously (Plugin plugin, Runnable task) throws IllegalArgumentException
 Asynchronous tasks should never access any API in Bukkit.
 
BukkitTask runTaskLater (Plugin plugin, Runnable task, long delay) throws IllegalArgumentException
 Returns a task that will run after the specified number of server ticks.
 
BukkitTask runTaskLaterAsynchronously (Plugin plugin, Runnable task, long delay) throws IllegalArgumentException
 Asynchronous tasks should never access any API in Bukkit.
 
BukkitTask runTaskTimer (Plugin plugin, Runnable task, long delay, long period) throws IllegalArgumentException
 Returns a task that will repeatedly run until cancelled, starting after the specified number of server ticks.
 
BukkitTask runTaskTimerAsynchronously (Plugin plugin, Runnable task, long delay, long period) throws IllegalArgumentException
 Asynchronous tasks should never access any API in Bukkit.
 

Detailed Description

Definition at line 8 of file BukkitScheduler.java.

Member Function Documentation

public<T> Future<T> org.bukkit.scheduler.BukkitScheduler.callSyncMethod ( Plugin  plugin,
Callable< T >  task 
)

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.

Parameters
<T>The callable's return type
pluginPlugin that owns the task
taskTask to be executed
Returns
Future Future object related to the task
void org.bukkit.scheduler.BukkitScheduler.cancelAllTasks ( )

Removes all tasks from the scheduler.

void org.bukkit.scheduler.BukkitScheduler.cancelTask ( int  taskId)

Removes task from scheduler.

Parameters
taskIdId number of task to be removed

Referenced by org.bukkit.scheduler.BukkitRunnable.cancel().

void org.bukkit.scheduler.BukkitScheduler.cancelTasks ( Plugin  plugin)

Removes all tasks associated with a particular plugin from the scheduler.

Parameters
pluginOwner of tasks to be removed

Referenced by org.bukkit.plugin.SimplePluginManager.disablePlugin().

List<BukkitWorker> org.bukkit.scheduler.BukkitScheduler.getActiveWorkers ( )

Returns a list of all active workers.

This list contains asynch tasks that are being executed by separate threads.

Returns
Active workers
List<BukkitTask> org.bukkit.scheduler.BukkitScheduler.getPendingTasks ( )

Returns a list of all pending tasks.

The ordering of the tasks is not related to their order of execution.

Returns
Active workers
boolean org.bukkit.scheduler.BukkitScheduler.isCurrentlyRunning ( int  taskId)

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.

Parameters
taskIdThe task to check.
Returns
If the task is currently running.
boolean org.bukkit.scheduler.BukkitScheduler.isQueued ( 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.

Parameters
taskIdThe task to check.
Returns
If the task is queued to be run.
BukkitTask org.bukkit.scheduler.BukkitScheduler.runTask ( Plugin  plugin,
Runnable  task 
) throws IllegalArgumentException

Returns a task that will run on the next server tick.

Parameters
pluginthe reference to the plugin scheduling task
taskthe task to be run
Returns
a BukkitTask that contains the id number
Exceptions
IllegalArgumentExceptionif plugin is null
IllegalArgumentExceptionif task is null

Referenced by org.bukkit.scheduler.BukkitRunnable.runTask().

BukkitTask org.bukkit.scheduler.BukkitScheduler.runTaskAsynchronously ( Plugin  plugin,
Runnable  task 
) throws IllegalArgumentException

Asynchronous tasks should never access any API in Bukkit.

Great care should be taken to assure the thread-safety of asynchronous tasks.

Returns a task that will run asynchronously.

Parameters
pluginthe reference to the plugin scheduling task
taskthe task to be run
Returns
a BukkitTask that contains the id number
Exceptions
IllegalArgumentExceptionif plugin is null
IllegalArgumentExceptionif task is null

Referenced by org.bukkit.scheduler.BukkitRunnable.runTaskAsynchronously().

BukkitTask org.bukkit.scheduler.BukkitScheduler.runTaskLater ( Plugin  plugin,
Runnable  task,
long  delay 
) throws IllegalArgumentException

Returns a task that will run after the specified number of server ticks.

Parameters
pluginthe reference to the plugin scheduling task
taskthe task to be run
delaythe ticks to wait before running the task
Returns
a BukkitTask that contains the id number
Exceptions
IllegalArgumentExceptionif plugin is null
IllegalArgumentExceptionif task is null

Referenced by org.bukkit.scheduler.BukkitRunnable.runTaskLater().

BukkitTask org.bukkit.scheduler.BukkitScheduler.runTaskLaterAsynchronously ( Plugin  plugin,
Runnable  task,
long  delay 
) throws IllegalArgumentException

Asynchronous tasks should never access any API in Bukkit.

Great care should be taken to assure the thread-safety of asynchronous tasks.

Returns a task that will run asynchronously after the specified number of server ticks.

Parameters
pluginthe reference to the plugin scheduling task
taskthe task to be run
delaythe ticks to wait before running the task
Returns
a BukkitTask that contains the id number
Exceptions
IllegalArgumentExceptionif plugin is null
IllegalArgumentExceptionif task is null

Referenced by org.bukkit.scheduler.BukkitRunnable.runTaskLaterAsynchronously().

BukkitTask org.bukkit.scheduler.BukkitScheduler.runTaskTimer ( Plugin  plugin,
Runnable  task,
long  delay,
long  period 
) throws IllegalArgumentException

Returns a task that will repeatedly run until cancelled, starting after the specified number of server ticks.

Parameters
pluginthe reference to the plugin scheduling task
taskthe task to be run
delaythe ticks to wait before running the task
periodthe ticks to wait between runs
Returns
a BukkitTask that contains the id number
Exceptions
IllegalArgumentExceptionif plugin is null
IllegalArgumentExceptionif task is null

Referenced by org.bukkit.scheduler.BukkitRunnable.runTaskTimer().

BukkitTask org.bukkit.scheduler.BukkitScheduler.runTaskTimerAsynchronously ( Plugin  plugin,
Runnable  task,
long  delay,
long  period 
) throws IllegalArgumentException

Asynchronous tasks should never access any API in Bukkit.

Great care should be taken to assure the thread-safety of asynchronous tasks.

Returns a task that will repeatedly run asynchronously until cancelled, starting after the specified number of server ticks.

Parameters
pluginthe reference to the plugin scheduling task
taskthe task to be run
delaythe ticks to wait before running the task for the first time
periodthe ticks to wait between runs
Returns
a BukkitTask that contains the id number
Exceptions
IllegalArgumentExceptionif plugin is null
IllegalArgumentExceptionif task is null

Referenced by org.bukkit.scheduler.BukkitRunnable.runTaskTimerAsynchronously().

int org.bukkit.scheduler.BukkitScheduler.scheduleAsyncDelayedTask ( Plugin  plugin,
Runnable  task,
long  delay 
)

Asynchronous tasks should never access any API in Bukkit.

Great care should be taken to assure the thread-safety of asynchronous tasks.

Schedules a once off task to occur after a delay. This task will be executed by a thread managed by the scheduler.

Parameters
pluginPlugin that owns the task
taskTask to be executed
delayDelay in server ticks before executing task
Returns
Task id number (-1 if scheduling failed)
Deprecated:
This name is misleading, as it does not schedule "a sync" task, but rather, "an async" task
int org.bukkit.scheduler.BukkitScheduler.scheduleAsyncDelayedTask ( Plugin  plugin,
Runnable  task 
)

Asynchronous tasks should never access any API in Bukkit.

Great care should be taken to assure the thread-safety of asynchronous tasks.

Schedules a once off task to occur as soon as possible. This task will be executed by a thread managed by the scheduler.

Parameters
pluginPlugin that owns the task
taskTask to be executed
Returns
Task id number (-1 if scheduling failed)
Deprecated:
This name is misleading, as it does not schedule "a sync" task, but rather, "an async" task
int org.bukkit.scheduler.BukkitScheduler.scheduleAsyncRepeatingTask ( Plugin  plugin,
Runnable  task,
long  delay,
long  period 
)

Asynchronous tasks should never access any API in Bukkit.

Great care should be taken to assure the thread-safety of asynchronous tasks.

Schedules a repeating task. This task will be executed by a thread managed by the scheduler.

Parameters
pluginPlugin that owns the task
taskTask to be executed
delayDelay in server ticks before executing first repeat
periodPeriod in server ticks of the task
Returns
Task id number (-1 if scheduling failed)
Deprecated:
This name is misleading, as it does not schedule "a sync" task, but rather, "an async" task
int org.bukkit.scheduler.BukkitScheduler.scheduleSyncDelayedTask ( Plugin  plugin,
Runnable  task,
long  delay 
)

Schedules a once off task to occur after a delay.

This task will be executed by the main server thread.

Parameters
pluginPlugin that owns the task
taskTask to be executed
delayDelay in server ticks before executing task
Returns
Task id number (-1 if scheduling failed)

Referenced by org.bukkit.permissions.PermissibleBase.addAttachment().

int org.bukkit.scheduler.BukkitScheduler.scheduleSyncDelayedTask ( Plugin  plugin,
Runnable  task 
)

Schedules a once off task to occur as soon as possible.

This task will be executed by the main server thread.

Parameters
pluginPlugin that owns the task
taskTask to be executed
Returns
Task id number (-1 if scheduling failed)
int org.bukkit.scheduler.BukkitScheduler.scheduleSyncRepeatingTask ( Plugin  plugin,
Runnable  task,
long  delay,
long  period 
)

Schedules a repeating task.

This task will be executed by the main server thread.

Parameters
pluginPlugin that owns the task
taskTask to be executed
delayDelay in server ticks before executing first repeat
periodPeriod in server ticks of the task
Returns
Task id number (-1 if scheduling failed)

The documentation for this interface was generated from the following file: