Skip to content

Commit

Permalink
Fix CB Names MCP->MOJ
Browse files Browse the repository at this point in the history
in scheduler
  • Loading branch information
C0D3-M4513R committed Nov 17, 2023
1 parent 337f437 commit b8c8896
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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<? super BukkitTask> task) throws IllegalArgumentException {
public void runTask(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> 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<? super BukkitTask> task) throws IllegalArgumentException {
public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> 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<? super BukkitTask> task, long delay) throws IllegalArgumentException {
public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> 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<? super BukkitTask> task, long delay) throws IllegalArgumentException {
public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException {
runTaskTimerAsynchronously(plugin, task, delay, CraftTask.NO_REPEATING);
}

@Override
public void runTaskTimerAsynchronously(Plugin plugin, Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {
public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> 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<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {
public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {
runTaskTimer(plugin, (Object) task, delay, period);
}

Expand All @@ -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);
}

Expand All @@ -230,7 +231,7 @@ public BukkitTask runTaskTimerAsynchronously(Plugin plugin, Object runnable, lon
}

@Override
public <T> Future<T> callSyncMethod(final Plugin plugin, final Callable<T> task) {
public <T> @NotNull Future<T> callSyncMethod(final @NotNull Plugin plugin, final @NotNull Callable<T> task) {
validate(plugin, task);
final CraftFuture<T> future = new CraftFuture<T>(task, plugin, nextId());
handle(future, 0L);
Expand Down Expand Up @@ -351,7 +352,7 @@ public boolean isQueued(final int taskId) {
}

@Override
public List<BukkitWorker> getActiveWorkers() {
public @NotNull List<BukkitWorker> getActiveWorkers() {
final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
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
Expand All @@ -368,7 +369,7 @@ public List<BukkitWorker> getActiveWorkers() {
}

@Override
public List<BukkitTask> getPendingTasks() {
public @NotNull List<BukkitTask> getPendingTasks() {
final ArrayList<CraftTask> truePending = new ArrayList<CraftTask>();
for (CraftTask task = head.getNext(); task != null; task = task.getNext()) {
if (task.getTaskId() != -1) {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/bukkit/scheduler/BukkitScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<BukkitTask> task) throws IllegalArgumentException;
public void runTask(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task) throws IllegalArgumentException;

/**
* @param plugin the reference to the plugin scheduling task
Expand Down Expand Up @@ -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<BukkitTask> task) throws IllegalArgumentException;
public void runTaskAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task) throws IllegalArgumentException;

/**
* @param plugin the reference to the plugin scheduling task
Expand Down Expand Up @@ -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<BukkitTask> task, long delay) throws IllegalArgumentException;
public void runTaskLater(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException;

/**
* @param plugin the reference to the plugin scheduling task
Expand Down Expand Up @@ -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<BukkitTask> task, long delay) throws IllegalArgumentException;
public void runTaskLaterAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay) throws IllegalArgumentException;

/**
* @param plugin the reference to the plugin scheduling task
Expand Down Expand Up @@ -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<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
public void runTaskTimer(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException;

/**
* @param plugin the reference to the plugin scheduling task
Expand Down Expand Up @@ -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<BukkitTask> task, long delay, long period) throws IllegalArgumentException;
public void runTaskTimerAsynchronously(@NotNull Plugin plugin, @NotNull Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException;

/**
* @param plugin the reference to the plugin scheduling task
Expand Down

0 comments on commit b8c8896

Please sign in to comment.