From bde2a93cfec0d4715df51ca101b9e97cd3be8762 Mon Sep 17 00:00:00 2001 From: blablubbabc Date: Tue, 29 Aug 2017 13:46:18 +0200 Subject: [PATCH] Add BukkitTask#isCancelled --- .../java/org/bukkit/craftbukkit/scheduler/CraftFuture.java | 4 ---- .../java/org/bukkit/craftbukkit/scheduler/CraftTask.java | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java index 1baec564c0..191a1c13e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java @@ -28,10 +28,6 @@ class CraftFuture extends CraftTask implements Future { return true; } - public boolean isCancelled() { - return getPeriod() == -2l; - } - public boolean isDone() { final long period = this.getPeriod(); return period != -1l && period != -3l; diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java index 55db3ff868..9cb666bb1e 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -81,6 +81,11 @@ class CraftTask implements BukkitTask, Runnable { return task.getClass(); } + @Override + public boolean isCancelled() { + return (period == -2l); + } + public void cancel() { Bukkit.getScheduler().cancelTask(id); }