Package net.glowstone.scheduler
Class GlowTask
- All Implemented Interfaces:
Runnable
,Future<Void>
,RunnableFuture<Void>
,org.bukkit.scheduler.BukkitTask
,org.bukkit.scheduler.BukkitWorker
public class GlowTask
extends FutureTask<Void>
implements org.bukkit.scheduler.BukkitTask, org.bukkit.scheduler.BukkitWorker
Represents a task which is executed periodically.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Stops this task.protected void
done()
net.glowstone.scheduler.TaskExecutionState
The last execution state returned byshouldExecute()
(most likely the state the task is currently in).org.bukkit.plugin.Plugin
getOwner()
The Plugin that owns this task.int
The ID of this task.The thread this task has been last executed on, if this task is async.boolean
isSync()
A flag indicating whether this task is to be run asynchronously.void
run()
toString()
Methods inherited from class java.util.concurrent.FutureTask
cancel, get, get, isCancelled, isDone, runAndReset, set, setException
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.bukkit.scheduler.BukkitTask
isCancelled
-
Constructor Details
-
GlowTask
public GlowTask(org.bukkit.plugin.Plugin owner, Runnable task, boolean sync, long delay, long period) Creates a new task with the specified number of ticks between consecutive calls to execute().- Parameters:
owner
- The plugin which started the task.task
- The runnable for this task.sync
- If the task should be run synchronously.delay
- The delay in ticks before running this task.period
- The delay in ticks before running this task again. -1 for no repeat.
-
-
Method Details
-
toString
- Overrides:
toString
in classFutureTask<Void>
-
cancel
public void cancel()Stops this task.- Specified by:
cancel
in interfaceorg.bukkit.scheduler.BukkitTask
-
run
public void run()- Specified by:
run
in interfaceRunnable
- Specified by:
run
in interfaceRunnableFuture<Void>
- Overrides:
run
in classFutureTask<Void>
-
done
protected void done()- Overrides:
done
in classFutureTask<Void>
-
getTaskId
public int getTaskId()The ID of this task.- Specified by:
getTaskId
in interfaceorg.bukkit.scheduler.BukkitTask
- Specified by:
getTaskId
in interfaceorg.bukkit.scheduler.BukkitWorker
-
getOwner
public org.bukkit.plugin.Plugin getOwner()The Plugin that owns this task.- Specified by:
getOwner
in interfaceorg.bukkit.scheduler.BukkitTask
- Specified by:
getOwner
in interfaceorg.bukkit.scheduler.BukkitWorker
-
isSync
public boolean isSync()A flag indicating whether this task is to be run asynchronously.- Specified by:
isSync
in interfaceorg.bukkit.scheduler.BukkitTask
-
getThread
The thread this task has been last executed on, if this task is async.- Specified by:
getThread
in interfaceorg.bukkit.scheduler.BukkitWorker
-
getLastExecutionState
public net.glowstone.scheduler.TaskExecutionState getLastExecutionState()The last execution state returned byshouldExecute()
(most likely the state the task is currently in).
-