Files
Bukkit/src/main/java/org/bukkit/scheduler/BukkitTask.java
Wesley Wolfe 2750276da3 Add simpler API for using the scheduler. Adds BUKKIT-836
The new methods return the actual task that gets created from the
scheduler. They are also named such that auto-complete puts the
asynchronous methods after the normal ones. These two additions are
simply semantic.

Tasks now have a method to cancel themselves using their task id. This
is provided as a convenience.

A new class called SimpleRunnable was added. It is an abstract Runnable
such that anonymous classes may subclass it. It provides six convenience
methods for scheduling as appropriate. It also provides a cancel method
for convenience. The functionality of SimpleRunnable only stores an
integer representing the task id. A SimpleRunnable can only be scheduled
once; attempting to reschedule results in IllegalStateException.
2012-10-14 02:05:29 -05:00

37 lines
662 B
Java

package org.bukkit.scheduler;
import org.bukkit.plugin.Plugin;
/**
* Represents a task being executed by the scheduler
*/
public interface BukkitTask {
/**
* Returns the taskId for the task
*
* @return Task id number
*/
public int getTaskId();
/**
* Returns the Plugin that owns this task
*
* @return The Plugin that owns the task
*/
public Plugin getOwner();
/**
* Returns true if the Task is a sync task
*
* @return true if the task is run by main thread
*/
public boolean isSync();
/**
* Will attempt to cancel this task
*/
public void cancel();
}