From 246c53f5a2ae3a3a4d3dcdd6ffff0530278e59d6 Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Thu, 7 Aug 2014 19:26:52 -0500 Subject: Add deprecated BukkitRunnable overloads in the scheduler. Adds BUKKIT-5752 --- .../java/org/bukkit/scheduler/BukkitRunnable.java | 12 ++--- .../java/org/bukkit/scheduler/BukkitScheduler.java | 54 ++++++++++++++++++++++ 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/bukkit/scheduler/BukkitRunnable.java b/src/main/java/org/bukkit/scheduler/BukkitRunnable.java index 03519443..c146ec7a 100644 --- a/src/main/java/org/bukkit/scheduler/BukkitRunnable.java +++ b/src/main/java/org/bukkit/scheduler/BukkitRunnable.java @@ -29,7 +29,7 @@ public abstract class BukkitRunnable implements Runnable { */ public synchronized BukkitTask runTask(Plugin plugin) throws IllegalArgumentException, IllegalStateException { checkState(); - return setupId(Bukkit.getScheduler().runTask(plugin, this)); + return setupId(Bukkit.getScheduler().runTask(plugin, (Runnable) this)); } /** @@ -46,7 +46,7 @@ public abstract class BukkitRunnable implements Runnable { */ public synchronized BukkitTask runTaskAsynchronously(Plugin plugin) throws IllegalArgumentException, IllegalStateException { checkState(); - return setupId(Bukkit.getScheduler().runTaskAsynchronously(plugin, this)); + return setupId(Bukkit.getScheduler().runTaskAsynchronously(plugin, (Runnable) this)); } /** @@ -61,7 +61,7 @@ public abstract class BukkitRunnable implements Runnable { */ public synchronized BukkitTask runTaskLater(Plugin plugin, long delay) throws IllegalArgumentException, IllegalStateException { checkState(); - return setupId(Bukkit.getScheduler().runTaskLater(plugin, this, delay)); + return setupId(Bukkit.getScheduler().runTaskLater(plugin, (Runnable) this, delay)); } /** @@ -80,7 +80,7 @@ public abstract class BukkitRunnable implements Runnable { */ public synchronized BukkitTask runTaskLaterAsynchronously(Plugin plugin, long delay) throws IllegalArgumentException, IllegalStateException { checkState(); - return setupId(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, this, delay)); + return setupId(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, (Runnable) this, delay)); } /** @@ -97,7 +97,7 @@ public abstract class BukkitRunnable implements Runnable { */ public synchronized BukkitTask runTaskTimer(Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException { checkState(); - return setupId(Bukkit.getScheduler().runTaskTimer(plugin, this, delay, period)); + return setupId(Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) this, delay, period)); } /** @@ -119,7 +119,7 @@ public abstract class BukkitRunnable implements Runnable { */ public synchronized BukkitTask runTaskTimerAsynchronously(Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException { checkState(); - return setupId(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, this, delay, period)); + return setupId(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, (Runnable) this, delay, period)); } /** diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java index 44d94f08..dfecafa7 100644 --- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java @@ -19,6 +19,12 @@ public interface BukkitScheduler { */ public int scheduleSyncDelayedTask(Plugin plugin, Runnable task, long delay); + /** + * @deprecated Use {@link BukkitRunnable#runTaskLater(Plugin, long)} + */ + @Deprecated + public int scheduleSyncDelayedTask(Plugin plugin, BukkitRunnable task, long delay); + /** * Schedules a once off task to occur as soon as possible. *

@@ -30,6 +36,12 @@ public interface BukkitScheduler { */ public int scheduleSyncDelayedTask(Plugin plugin, Runnable task); + /** + * @deprecated Use {@link BukkitRunnable#runTask(Plugin)} + */ + @Deprecated + public int scheduleSyncDelayedTask(Plugin plugin, BukkitRunnable task); + /** * Schedules a repeating task. *

@@ -43,6 +55,12 @@ public interface BukkitScheduler { */ public int scheduleSyncRepeatingTask(Plugin plugin, Runnable task, long delay, long period); + /** + * @deprecated Use {@link BukkitRunnable#runTaskTimer(Plugin, long, long)} + */ + @Deprecated + public int scheduleSyncRepeatingTask(Plugin plugin, BukkitRunnable task, long delay, long period); + /** * Asynchronous tasks should never access any API in Bukkit. Great care * should be taken to assure the thread-safety of asynchronous tasks. @@ -188,6 +206,12 @@ public interface BukkitScheduler { */ public BukkitTask runTask(Plugin plugin, Runnable task) throws IllegalArgumentException; + /** + * @deprecated Use {@link BukkitRunnable#runTask(Plugin)} + */ + @Deprecated + public BukkitTask runTask(Plugin plugin, BukkitRunnable task) throws IllegalArgumentException; + /** * Asynchronous tasks should never access any API in Bukkit. Great care * should be taken to assure the thread-safety of asynchronous tasks. @@ -202,6 +226,12 @@ public interface BukkitScheduler { */ public BukkitTask runTaskAsynchronously(Plugin plugin, Runnable task) throws IllegalArgumentException; + /** + * @deprecated Use {@link BukkitRunnable#runTaskAsynchronously(Plugin)} + */ + @Deprecated + public BukkitTask runTaskAsynchronously(Plugin plugin, BukkitRunnable task) throws IllegalArgumentException; + /** * Returns a task that will run after the specified number of server * ticks. @@ -215,6 +245,12 @@ public interface BukkitScheduler { */ public BukkitTask runTaskLater(Plugin plugin, Runnable task, long delay) throws IllegalArgumentException; + /** + * @deprecated Use {@link BukkitRunnable#runTaskLater(Plugin, long)} + */ + @Deprecated + public BukkitTask runTaskLater(Plugin plugin, BukkitRunnable task, long delay) throws IllegalArgumentException; + /** * Asynchronous tasks should never access any API in Bukkit. Great care * should be taken to assure the thread-safety of asynchronous tasks. @@ -231,6 +267,12 @@ public interface BukkitScheduler { */ public BukkitTask runTaskLaterAsynchronously(Plugin plugin, Runnable task, long delay) throws IllegalArgumentException; + /** + * @deprecated Use {@link BukkitRunnable#runTaskLaterAsynchronously(Plugin, long)} + */ + @Deprecated + public BukkitTask runTaskLaterAsynchronously(Plugin plugin, BukkitRunnable task, long delay) throws IllegalArgumentException; + /** * Returns a task that will repeatedly run until cancelled, starting after * the specified number of server ticks. @@ -245,6 +287,12 @@ public interface BukkitScheduler { */ public BukkitTask runTaskTimer(Plugin plugin, Runnable task, long delay, long period) throws IllegalArgumentException; + /** + * @deprecated Use {@link BukkitRunnable#runTaskTimer(Plugin, long, long)} + */ + @Deprecated + public BukkitTask runTaskTimer(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException; + /** * Asynchronous tasks should never access any API in Bukkit. Great care * should be taken to assure the thread-safety of asynchronous tasks. @@ -262,4 +310,10 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if task is null */ public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Runnable task, long delay, long period) throws IllegalArgumentException; + + /** + * @deprecated Use {@link BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)} + */ + @Deprecated + public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException; } -- cgit v1.2.3