Class NukkitRunnable
java.lang.Object
org.cloudburstmc.server.scheduler.NukkitRunnable
- All Implemented Interfaces:
Runnable
This class is provided as an easy way to handle scheduling tasks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Attempts to cancel this task.intGets the task id for this runnable.runTaskAsynchronously(Object plugin)runTaskLater(Object plugin, int delay)runTaskLaterAsynchronously(Object plugin, int delay)runTaskTimer(Object plugin, int delay, int period)runTaskTimerAsynchronously(Object plugin, int delay, int period)
-
Constructor Details
-
NukkitRunnable
public NukkitRunnable()
-
-
Method Details
-
cancel
Attempts to cancel this task.- Throws:
IllegalStateException- if task was not scheduled yet
-
runTask
-
runTaskAsynchronously
public Runnable runTaskAsynchronously(Object plugin) throws IllegalArgumentException, IllegalStateException -
runTaskLater
public Runnable runTaskLater(Object plugin, int delay) throws IllegalArgumentException, IllegalStateException -
runTaskLaterAsynchronously
public Runnable runTaskLaterAsynchronously(Object plugin, int delay) throws IllegalArgumentException, IllegalStateException -
runTaskTimer
public Runnable runTaskTimer(Object plugin, int delay, int period) throws IllegalArgumentException, IllegalStateException -
runTaskTimerAsynchronously
public Runnable runTaskTimerAsynchronously(Object plugin, int delay, int period) throws IllegalArgumentException, IllegalStateException -
getTaskId
Gets the task id for this runnable.- Returns:
- the task id that this runnable was scheduled as
- Throws:
IllegalStateException- if task was not scheduled yet
-