* This task will be executed by the main server thread. * - * @param task Task to be executed + * @param task Task to be executed * @param delay Delay in server ticks before executing task - * @return Task id number (-1 if scheduling failed) + * Task id number (-1 if scheduling failed) */ - public int scheduleSyncDelayedTask(Runnable task, long delay) { - return Bukkit.getScheduler().scheduleSyncDelayedTask(authMe, task, delay); + public void scheduleSyncDelayedTask(Runnable task, long delay) { + MyScheduledTask tsk = AuthMe.getScheduler().runTaskLater(task, delay); } /** @@ -76,7 +77,7 @@ public class BukkitService implements SettingsDependent { */ public void scheduleSyncTaskFromOptionallyAsyncTask(Runnable task) { if (Bukkit.isPrimaryThread()) { - task.run(); + AuthMe.getScheduler().runTask(task); } else { scheduleSyncDelayedTask(task); } @@ -86,12 +87,12 @@ public class BukkitService implements SettingsDependent { * Returns a task that will run on the next server tick. * * @param task the task to be run - * @return a BukkitTask that contains the id number + * a BukkitTask that contains the id number * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public BukkitTask runTask(Runnable task) { - return Bukkit.getScheduler().runTask(authMe, task); + public void runTask(Runnable task) { + AuthMe.getScheduler().runTask(task); } /** @@ -105,7 +106,7 @@ public class BukkitService implements SettingsDependent { * @throws IllegalArgumentException if task is null */ public BukkitTask runTaskLater(Runnable task, long delay) { - return Bukkit.getScheduler().runTaskLater(authMe, task, delay); + return (BukkitTask) AuthMe.getScheduler().runTaskLater(task, delay); } /** @@ -116,9 +117,9 @@ public class BukkitService implements SettingsDependent { */ public void runTaskOptionallyAsync(Runnable task) { if (useAsyncTasks) { - runTaskAsynchronously(task); + AuthMe.getScheduler().runTaskAsynchronously(task); } else { - task.run(); + AuthMe.getScheduler().runTask(task); } } @@ -129,12 +130,12 @@ public class BukkitService implements SettingsDependent { * Returns a task that will run asynchronously. * * @param task the task to be run - * @return a BukkitTask that contains the id number + * a BukkitTask that contains the id number * @throws IllegalArgumentException if plugin is null * @throws IllegalArgumentException if task is null */ - public BukkitTask runTaskAsynchronously(Runnable task) { - return Bukkit.getScheduler().runTaskAsynchronously(authMe, task); + public void runTaskAsynchronously(Runnable task) { + AuthMe.getScheduler().runTaskAsynchronously(task); } /** @@ -148,27 +149,27 @@ public class BukkitService implements SettingsDependent { * @param delay the ticks to wait before running the task for the first * time * @param period the ticks to wait between runs - * @return a BukkitTask that contains the id number + * a BukkitTask that contains the id number * @throws IllegalArgumentException if task is null * @throws IllegalStateException if this was already scheduled */ - public BukkitTask runTaskTimerAsynchronously(BukkitRunnable task, long delay, long period) { - return task.runTaskTimerAsynchronously(authMe, delay, period); + public void runTaskTimerAsynchronously(BukkitRunnable task, long delay, long period) { + AuthMe.getScheduler().runTaskTimerAsynchronously(task, delay, period); } /** * Schedules the given task to repeatedly run until cancelled, starting after the * specified number of server ticks. * - * @param task the task to schedule - * @param delay the ticks to wait before running the task + * @param task the task to schedule + * @param delay the ticks to wait before running the task * @param period the ticks to wait between runs - * @return a BukkitTask that contains the id number + * a BukkitTask that contains the id number * @throws IllegalArgumentException if plugin is null - * @throws IllegalStateException if this was already scheduled + * @throws IllegalStateException if this was already scheduled */ - public BukkitTask runTaskTimer(BukkitRunnable task, long delay, long period) { - return task.runTaskTimer(authMe, delay, period); + public void runTaskTimer(BukkitRunnable task, long delay, long period) { + AuthMe.getScheduler().runTaskTimer(task, delay, period); } /** diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 3774e109..f0b0ebc8 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -16,6 +16,7 @@ softdepend: - EssentialsSpawn - ProtocolLib - floodgate +folia-supported: true commands: authme: description: AuthMe op commands