public final class Scheduler extends Object
Modifier and Type | Method and Description |
---|---|
static void |
cancelAllTasks()
Cancels all running tasks/threads and clears the cached queue.
|
static ScheduledExecutorService |
getService()
Returns the underlying
ScheduledExecutorService used for this
utility class |
static ScheduledFuture<?> |
runAsyncTask(Runnable r)
Immediately runs a single asynchronous task
|
static ScheduledFuture<?> |
runAsyncTask(Runnable r,
long delay)
Runs a single asynchronous task
|
static ScheduledFuture<?> |
runAsyncTaskRepeat(Runnable r,
long startAfter,
long delay)
Runs a repeating asynchronous task
|
static <T> ScheduledFuture<T> |
runCallable(Callable<T> c,
long delay)
Runs a Callable
|
static ScheduledFuture<?> |
runSyncTask(Runnable r,
long delay)
Runs a task after a specified delay on Bukkit's main thread
|
static ScheduledFuture<?> |
runSyncTaskRepeat(Runnable r,
long startAfter,
long delay)
Runs a task after a specified time on Bukkit's main thread, and repeats
it in intervals as specified by the
delay parameter |
public static ScheduledFuture<?> runAsyncTaskRepeat(Runnable r, long startAfter, long delay)
r
- The runnable to executestartAfter
- Time (in seconds) to wait before executiondelay
- Time (in seconds) between execution to waitpublic static ScheduledFuture<?> runAsyncTask(Runnable r, long delay)
r
- The runnable to executedelay
- Time (in seconds) to wait before executionpublic static ScheduledFuture<?> runAsyncTask(Runnable r)
r
- The runnable to executepublic static ScheduledFuture<?> runSyncTask(Runnable r, long delay)
r
- The Runnable
to executedelay
- Time (in seconds) to wait before executionpublic static ScheduledFuture<?> runSyncTaskRepeat(Runnable r, long startAfter, long delay)
delay
parameterr
- The Runnable
to executestartAfter
- Time (in seconds) to wait before executing at alldelay
- Time (in seconds) to wait in between executionspublic static <T> ScheduledFuture<T> runCallable(Callable<T> c, long delay)
T
- The return type of the Callable
c
- The callable to executedelay
- Time (in seconds) to wait before executionpublic static void cancelAllTasks()
public static ScheduledExecutorService getService()
ScheduledExecutorService
used for this
utility classScheduledExecutorService
Copyright © 2015. All rights reserved.