From b8c8896e0d3069486afdbbb80b48b5ed47ba0ce2 Mon Sep 17 00:00:00 2001 From: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com> Date: Sat, 18 Nov 2023 00:53:00 +0100 Subject: [PATCH] Fix CB Names MCP->MOJ in scheduler --- .../v1_20_R2/scheduler/CraftScheduler.java | 43 ++++++++++--------- .../org/bukkit/scheduler/BukkitScheduler.java | 12 +++--- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/v1_20_R2/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/v1_20_R2/scheduler/CraftScheduler.java index 0aa379908d..ed46c08170 100644 --- a/src/main/java/org/bukkit/craftbukkit/v1_20_R2/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/v1_20_R2/scheduler/CraftScheduler.java @@ -23,6 +23,7 @@ import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitWorker; +import org.jetbrains.annotations.NotNull; /** * The fundamental concepts for this implementation: @@ -111,84 +112,84 @@ StringBuilder debugTo(StringBuilder string) { } @Override - public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) { + public int scheduleSyncDelayedTask(final @NotNull Plugin plugin, final @NotNull Runnable task) { return this.scheduleSyncDelayedTask(plugin, task, 0L); } @Override - public BukkitTask runTask(Plugin plugin, Runnable runnable) { + public BukkitTask runTask(@NotNull Plugin plugin, @NotNull Runnable runnable) { return runTaskLater(plugin, runnable, 0L); } @Override - public void runTask(Plugin plugin, Consumer task) throws IllegalArgumentException { + public void runTask(@NotNull Plugin plugin, @NotNull Consumer task) throws IllegalArgumentException { runTaskLater(plugin, task, 0L); } @Deprecated @Override - public int scheduleAsyncDelayedTask(final Plugin plugin, final Runnable task) { + public int scheduleAsyncDelayedTask(final @NotNull Plugin plugin, final @NotNull Runnable task) { return this.scheduleAsyncDelayedTask(plugin, task, 0L); } @Override - public BukkitTask runTaskAsynchronously(Plugin plugin, Runnable runnable) { + public @NotNull BukkitTask runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Runnable runnable) { return runTaskLaterAsynchronously(plugin, runnable, 0L); } @Override - public void runTaskAsynchronously(Plugin plugin, Consumer task) throws IllegalArgumentException { + public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task) throws IllegalArgumentException { runTaskLaterAsynchronously(plugin, task, 0L); } @Override - public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task, final long delay) { + public int scheduleSyncDelayedTask(final @NotNull Plugin plugin, final @NotNull Runnable task, final long delay) { return this.scheduleSyncRepeatingTask(plugin, task, delay, CraftTask.NO_REPEATING); } @Override - public BukkitTask runTaskLater(Plugin plugin, Runnable runnable, long delay) { + public BukkitTask runTaskLater(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay) { return runTaskTimer(plugin, runnable, delay, CraftTask.NO_REPEATING); } @Override - public void runTaskLater(Plugin plugin, Consumer task, long delay) throws IllegalArgumentException { + public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer task, long delay) throws IllegalArgumentException { runTaskTimer(plugin, task, delay, CraftTask.NO_REPEATING); } @Deprecated @Override - public int scheduleAsyncDelayedTask(final Plugin plugin, final Runnable task, final long delay) { + public int scheduleAsyncDelayedTask(final @NotNull Plugin plugin, final @NotNull Runnable task, final long delay) { return this.scheduleAsyncRepeatingTask(plugin, task, delay, CraftTask.NO_REPEATING); } @Override - public BukkitTask runTaskLaterAsynchronously(Plugin plugin, Runnable runnable, long delay) { + public @NotNull BukkitTask runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay) { return runTaskTimerAsynchronously(plugin, runnable, delay, CraftTask.NO_REPEATING); } @Override - public void runTaskLaterAsynchronously(Plugin plugin, Consumer task, long delay) throws IllegalArgumentException { + public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task, long delay) throws IllegalArgumentException { runTaskTimerAsynchronously(plugin, task, delay, CraftTask.NO_REPEATING); } @Override - public void runTaskTimerAsynchronously(Plugin plugin, Consumer task, long delay, long period) throws IllegalArgumentException { + public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task, long delay, long period) throws IllegalArgumentException { runTaskTimerAsynchronously(plugin, (Object) task, delay, CraftTask.NO_REPEATING); } @Override - public int scheduleSyncRepeatingTask(final Plugin plugin, final Runnable runnable, long delay, long period) { + public int scheduleSyncRepeatingTask(final @NotNull Plugin plugin, final @NotNull Runnable runnable, long delay, long period) { return runTaskTimer(plugin, runnable, delay, period).getTaskId(); } @Override - public BukkitTask runTaskTimer(Plugin plugin, Runnable runnable, long delay, long period) { + public BukkitTask runTaskTimer(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay, long period) { return runTaskTimer(plugin, (Object) runnable, delay, period); } @Override - public void runTaskTimer(Plugin plugin, Consumer task, long delay, long period) throws IllegalArgumentException { + public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer task, long delay, long period) throws IllegalArgumentException { runTaskTimer(plugin, (Object) task, delay, period); } @@ -207,12 +208,12 @@ public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long @Deprecated @Override - public int scheduleAsyncRepeatingTask(final Plugin plugin, final Runnable runnable, long delay, long period) { + public int scheduleAsyncRepeatingTask(final @NotNull Plugin plugin, final @NotNull Runnable runnable, long delay, long period) { return runTaskTimerAsynchronously(plugin, runnable, delay, period).getTaskId(); } @Override - public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Runnable runnable, long delay, long period) { + public BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Runnable runnable, long delay, long period) { return runTaskTimerAsynchronously(plugin, (Object) runnable, delay, period); } @@ -230,7 +231,7 @@ public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Object runnable, lon } @Override - public Future callSyncMethod(final Plugin plugin, final Callable task) { + public @NotNull Future callSyncMethod(final @NotNull Plugin plugin, final @NotNull Callable task) { validate(plugin, task); final CraftFuture future = new CraftFuture(task, plugin, nextId()); handle(future, 0L); @@ -351,7 +352,7 @@ public boolean isQueued(final int taskId) { } @Override - public List getActiveWorkers() { + public @NotNull List getActiveWorkers() { final ArrayList workers = new ArrayList(); for (final CraftTask taskObj : runners.values()) { // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread @@ -368,7 +369,7 @@ public List getActiveWorkers() { } @Override - public List getPendingTasks() { + public @NotNull List getPendingTasks() { final ArrayList truePending = new ArrayList(); for (CraftTask task = head.getNext(); task != null; task = task.getNext()) { if (task.getTaskId() != -1) { diff --git a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java index 5aefb7f2de..0368e9125e 100644 --- a/src/main/java/org/bukkit/scheduler/BukkitScheduler.java +++ b/src/main/java/org/bukkit/scheduler/BukkitScheduler.java @@ -227,7 +227,7 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public void runTask(@NotNull Plugin plugin, @NotNull Consumer task) throws IllegalArgumentException; + public void runTask(@NotNull Plugin plugin, @NotNull Consumer task) throws IllegalArgumentException; /** * @param plugin the reference to the plugin scheduling task @@ -267,7 +267,7 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task) throws IllegalArgumentException; + public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task) throws IllegalArgumentException; /** * @param plugin the reference to the plugin scheduling task @@ -305,7 +305,7 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer task, long delay) throws IllegalArgumentException; + public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer task, long delay) throws IllegalArgumentException; /** * @param plugin the reference to the plugin scheduling task @@ -350,7 +350,7 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task, long delay) throws IllegalArgumentException; + public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task, long delay) throws IllegalArgumentException; /** * @param plugin the reference to the plugin scheduling task @@ -391,7 +391,7 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer task, long delay, long period) throws IllegalArgumentException; + public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer task, long delay, long period) throws IllegalArgumentException; /** * @param plugin the reference to the plugin scheduling task @@ -441,7 +441,7 @@ public interface BukkitScheduler { * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task, long delay, long period) throws IllegalArgumentException; + public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer task, long delay, long period) throws IllegalArgumentException; /** * @param plugin the reference to the plugin scheduling task