Add BukkitTask#isCancelled

This commit is contained in:
blablubbabc 2017-08-29 13:46:18 +02:00 committed by md_5
parent 8bf06d6cbf
commit bde2a93cfe
2 changed files with 5 additions and 4 deletions

View File

@ -28,10 +28,6 @@ class CraftFuture<T> extends CraftTask implements Future<T> {
return true; return true;
} }
public boolean isCancelled() {
return getPeriod() == -2l;
}
public boolean isDone() { public boolean isDone() {
final long period = this.getPeriod(); final long period = this.getPeriod();
return period != -1l && period != -3l; return period != -1l && period != -3l;

View File

@ -81,6 +81,11 @@ class CraftTask implements BukkitTask, Runnable {
return task.getClass(); return task.getClass();
} }
@Override
public boolean isCancelled() {
return (period == -2l);
}
public void cancel() { public void cancel() {
Bukkit.getScheduler().cancelTask(id); Bukkit.getScheduler().cancelTask(id);
} }