Package com.welcome234.pluginsystem
Class TaskScheduler
java.lang.Object
com.welcome234.pluginsystem.TaskScheduler
- All Implemented Interfaces:
Runnable
Task Schedulers are used to run tasks with the ticking of the server.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels this task and will no longer be executed by the serverintgetID()Gets the current ID number of this taskgetOwner()Gets the plugin that runs this taskbooleanGets whether this task is currently running and is still being executed by the servervoidrunLater(PluginJava plugin, int delay)Runs this task delayed after the specified tick countvoidrunTimer(PluginJava plugin, int delay, int period)Runs this task repeatedly with the specified tick interval
-
Constructor Details
-
TaskScheduler
public TaskScheduler()
-
-
Method Details
-
isRunning
public boolean isRunning()Gets whether this task is currently running and is still being executed by the server- Returns:
- Whether running
-
getID
public int getID()Gets the current ID number of this task- Returns:
- The task ID
- Throws:
IllegalArgumentException- if this task is not running
-
getOwner
Gets the plugin that runs this task- Returns:
- Plugin instance
- Throws:
IllegalArgumentException- if this task is not running
-
cancel
public void cancel()Cancels this task and will no longer be executed by the server- Throws:
IllegalArgumentException- if this task is not running
-
runLater
Runs this task delayed after the specified tick count- Parameters:
plugin- Plugin instancedelay- Delay in ticks- Throws:
IllegalArgumentException- if plugin is nullIllegalArgumentException- if the task is already started and runningIllegalStateException- if the plugin is disabled or is not loaded
-
runTimer
Runs this task repeatedly with the specified tick interval- Parameters:
plugin- Plugin instancedelay- Delay in ticksperiod- Interval in ticks- Throws:
IllegalArgumentException- if plugin is nullIllegalArgumentException- if the task is already started and runningIllegalStateException- if the plugin is disabled or is not loaded
-