public class DelayedSingleTask
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
closed |
protected Plugin |
plugin |
protected BukkitScheduler |
scheduler |
protected int |
taskID |
Constructor and Description |
---|
DelayedSingleTask(Plugin plugin)
Create a single task scheduler.
|
DelayedSingleTask(Plugin plugin,
BukkitScheduler scheduler)
Create a single task scheduler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Cancel a future task from being executed.
|
void |
close()
Stop the current task and all future tasks scheduled by this instance.
|
protected void |
finalize() |
Plugin |
getPlugin()
Retrieve the plugin this task belongs to.
|
int |
getTaskID()
Retrieve the raw task ID.
|
boolean |
isRunning()
Whether or not a future task is scheduled to be executed.
|
boolean |
schedule(long ticksDelay,
java.lang.Runnable task)
Schedule a single task for execution.
|
protected int taskID
protected Plugin plugin
protected BukkitScheduler scheduler
protected boolean closed
public DelayedSingleTask(Plugin plugin)
plugin
- - owner plugin.public DelayedSingleTask(Plugin plugin, BukkitScheduler scheduler)
plugin
- - owner plugin.scheduler
- - specialized scheduler.public boolean schedule(long ticksDelay, java.lang.Runnable task)
Any previously scheduled task will be automatically cancelled.
Note that a tick delay of zero will execute the task immediately.
ticksDelay
- - number of ticks before the task is executed.task
- - the task to schedule.public boolean isRunning()
public boolean cancel()
public int getTaskID()
public Plugin getPlugin()
public void close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable