@ThreadSafe public interface Scheduler extends Registry<ScheduledTask>
In this context, synchronously defines a task which is run on the same thread which the plugin that submitted it is also running on. An asynchronous task runs on a separate thread pool and requires the accessed state to be correct synchronized to prevent inconsistencies.
Ticks are a measurement of time which take place every 1/20th of a second. This is measured by the server's ticking thread comparing the timestamps since the epoch.
This class can be accessed using Registered.tasks()
Modifier and Type | Method and Description |
---|---|
ScheduledTask |
asyncLater(Plugin plugin,
ScheduledRunnable runnable,
long delay)
Asynchronously run a task after a specified time has passed
|
ScheduledTask |
asyncRepeat(Plugin plugin,
ScheduledRunnable runnable,
long delay,
long initialInterval)
Asynchronously run a task repeatedly
|
ScheduledTask |
asyncRun(Plugin plugin,
ScheduledRunnable runnable)
Asynchronously run a task after the next tick
|
ScheduledTask |
syncLater(Plugin plugin,
ScheduledRunnable runnable,
long delay)
Asynchronously run a task after a specified time has passed
|
ScheduledTask |
syncRepeat(Plugin plugin,
ScheduledRunnable runnable,
long delay,
long initialInterval)
Synchronously run a task repeatedly
|
ScheduledTask |
syncRun(Plugin plugin,
ScheduledRunnable runnable)
Synchronously run a task after the next tick
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
ScheduledTask asyncRun(Plugin plugin, ScheduledRunnable runnable)
plugin
- the plugin which the task is registered torunnable
- the runnable to perform the taskScheduledTask syncRun(Plugin plugin, ScheduledRunnable runnable)
plugin
- the plugin which the task is registered torunnable
- the runnable to perform the taskScheduledTask asyncLater(Plugin plugin, ScheduledRunnable runnable, long delay)
plugin
- the plugin which the task is registered torunnable
- the runnable to perform the taskdelay
- the amount of ticks to wait until the task is executedScheduledTask syncLater(Plugin plugin, ScheduledRunnable runnable, long delay)
plugin
- the plugin which the task is registered torunnable
- the runnable to perform the taskdelay
- the amount of ticks to wait until the task is executedScheduledTask asyncRepeat(Plugin plugin, ScheduledRunnable runnable, long delay, long initialInterval)
plugin
- the plugin which the task is registered torunnable
- the runnable to perform the taskdelay
- the amount of ticks to wait until the task is executedinitialInterval
- the amount of time between each execution which occurs repeatedly until cancelledScheduledTask syncRepeat(Plugin plugin, ScheduledRunnable runnable, long delay, long initialInterval)
plugin
- the plugin which the task is registered torunnable
- the runnable to perform the taskdelay
- the amount of ticks to wait until the task is executedinitialInterval
- the amount of time between each execution which occurs repeatedly until cancelledCopyright © 2016. All rights reserved.