public abstract class BukkitRunnable
extends java.lang.Object
implements java.lang.Runnable
构造器和说明 |
---|
BukkitRunnable() |
限定符和类型 | 方法和说明 |
---|---|
void |
cancel()
尝试取消这个任务
原文:Attempts to cancel this task.
|
int |
getTaskId()
获取这个已执行的任务的任务id.
|
boolean |
isCancelled()
若该任务被取消返回true.
|
BukkitTask |
runTask(Plugin plugin)
让Bukkit任务调度器在下一个tick运行任务.
|
BukkitTask |
runTaskAsynchronously(Plugin plugin)
在Bukkit任务调度器异步运行这个任务.
|
BukkitTask |
runTaskLater(Plugin plugin,
long delay)
在指定tick后执行该任务.
|
BukkitTask |
runTaskLaterAsynchronously(Plugin plugin,
long delay)
让Bukkit任务调度器在指定的tick后异步执行这个任务.
|
BukkitTask |
runTaskTimer(Plugin plugin,
long delay,
long period)
在指定时间后开始以指定的间隔不断执行任务.
|
BukkitTask |
runTaskTimerAsynchronously(Plugin plugin,
long delay,
long period)
让Bukkit任务调度器在指定的tick后开始异步的以指定的间隔不断执行任务.
|
public boolean isCancelled() throws java.lang.IllegalStateException
原文:Returns true if this task has been cancelled.
java.lang.IllegalStateException
- 若任务还未被调度public void cancel() throws java.lang.IllegalStateException
原文:Attempts to cancel this task.
java.lang.IllegalStateException
- 如果任务还没有被执行public BukkitTask runTask(Plugin plugin) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
原文:Schedules this in the Bukkit scheduler to run on next tick.
plugin
- 创建任务的插件BukkitTask
java.lang.IllegalArgumentException
- 如果plugin为nulljava.lang.IllegalStateException
- 如果任务已经被执行/准备执行BukkitScheduler.runTask(Plugin, Runnable)
public BukkitTask runTaskAsynchronously(Plugin plugin) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
异步任务不能访问任何Bukkit里的API.应着重保证异步任务的线程安全.
原文:Asynchronous tasks should never access any API in Bukkit. Great care should be taken to assure the thread-safety of asynchronous tasks.
Schedules this in the Bukkit scheduler to run asynchronously.
plugin
- 创建任务的插件BukkitTask
java.lang.IllegalArgumentException
- 如果plugin为nulljava.lang.IllegalStateException
- 如果这个任务已经被执行/准备执行BukkitScheduler.runTaskAsynchronously(Plugin, Runnable)
public BukkitTask runTaskLater(Plugin plugin, long delay) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
原文:Schedules this to run after the specified number of server ticks.
plugin
- 创建任务的插件delay
- 在任务执行前等待的时间/tickBukkitTask
java.lang.IllegalArgumentException
- 如果plugin为nulljava.lang.IllegalStateException
- 如果这个任务已经被执行/准备执行BukkitScheduler.runTaskLater(Plugin, Runnable, long)
public BukkitTask runTaskLaterAsynchronously(Plugin plugin, long delay) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
异步任务不能访问任何Bukkit里的API.应着重保证异步任务的线程安全.
原文:Asynchronous tasks should never access any API in Bukkit. Great care should be taken to assure the thread-safety of asynchronous tasks.
Schedules this to run asynchronously after the specified number of server ticks.
plugin
- 创建任务的插件delay
- 在任务执行前等待的时间/tickjava.lang.IllegalArgumentException
- 如果plugin为nulljava.lang.IllegalStateException
- 如果这个任务已经被执行/准备执行BukkitScheduler.runTaskLaterAsynchronously(Plugin, Runnable, long)
public BukkitTask runTaskTimer(Plugin plugin, long delay, long period) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
原文:Schedules this to repeatedly run until cancelled, starting after the specified number of server ticks.
plugin
- 创建任务的插件delay
- 在任务执行前等待的时间/tickperiod
- 重复执行任务之间的时间间隔/tickjava.lang.IllegalArgumentException
- 如果插件为nulljava.lang.IllegalStateException
- 如果这个任务已经被执行/准备执行BukkitScheduler.runTaskTimer(Plugin, Runnable, long, long)
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, long delay, long period) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
异步任务不能访问任何Bukkit里的API.应着重保证异步任务的线程安全.
原文:Asynchronous tasks should never access any API in Bukkit. Great care should be taken to assure the thread-safety of asynchronous tasks.
Schedules this to repeatedly run asynchronously until cancelled, starting after the specified number of server ticks.
plugin
- 创建任务的插件delay
- 在任务执行前等待的时间/tickperiod
- 重复执行任务之间的时间间隔/tickjava.lang.IllegalArgumentException
- 如果插件为nulljava.lang.IllegalStateException
- 如果这个任务已经被执行/准备执行BukkitScheduler.runTaskTimerAsynchronously(Plugin, Runnable, long,
long)
public int getTaskId() throws java.lang.IllegalStateException
原文:Gets the task id for this runnable.
java.lang.IllegalStateException
- 如果这个任务还没有被执行