Class TaskUtil
java.lang.Object
com.github.darksoulq.abyssallib.server.util.TaskUtil
Utility class for scheduling Bukkit tasks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcancelTask(org.bukkit.scheduler.BukkitTask task) Cancels a BukkitTask safely.static org.bukkit.scheduler.BukkitTaskdelayedAsyncTask(org.bukkit.plugin.Plugin plugin, int delay, Runnable task) Runs a task asynchronously once after a specified delay.static org.bukkit.scheduler.BukkitTaskdelayedTask(org.bukkit.plugin.Plugin plugin, int delay, Runnable task) Runs a task once after a specified delay.static org.bukkit.scheduler.BukkitTaskrepeatingAsyncTask(org.bukkit.plugin.Plugin plugin, int delay, int interval, Runnable task) Runs a task asynchronously repeatedly with a delay and interval.static org.bukkit.scheduler.BukkitTaskrepeatingTask(org.bukkit.plugin.Plugin plugin, int delay, int interval, Runnable task) Runs a task repeatedly with a delay and interval.
-
Constructor Details
-
TaskUtil
public TaskUtil()
-
-
Method Details
-
delayedTask
public static org.bukkit.scheduler.BukkitTask delayedTask(org.bukkit.plugin.Plugin plugin, int delay, Runnable task) Runs a task once after a specified delay.- Parameters:
plugin- the plugin instancedelay- delay in ticks before running the tasktask- the task to run- Returns:
- the BukkitTask instance
-
repeatingTask
public static org.bukkit.scheduler.BukkitTask repeatingTask(org.bukkit.plugin.Plugin plugin, int delay, int interval, Runnable task) Runs a task repeatedly with a delay and interval.- Parameters:
plugin- the plugin instancedelay- delay in ticks before first runinterval- interval in ticks between runstask- the task to run- Returns:
- the BukkitTask instance
-
delayedAsyncTask
public static org.bukkit.scheduler.BukkitTask delayedAsyncTask(org.bukkit.plugin.Plugin plugin, int delay, Runnable task) Runs a task asynchronously once after a specified delay.- Parameters:
plugin- the plugin instancedelay- delay in ticks before running the tasktask- the task to run- Returns:
- the BukkitTask instance
-
repeatingAsyncTask
public static org.bukkit.scheduler.BukkitTask repeatingAsyncTask(org.bukkit.plugin.Plugin plugin, int delay, int interval, Runnable task) Runs a task asynchronously repeatedly with a delay and interval.- Parameters:
plugin- the plugin instancedelay- delay in ticks before first runinterval- interval in ticks between runstask- the task to run- Returns:
- the BukkitTask instance
-
cancelTask
public static void cancelTask(org.bukkit.scheduler.BukkitTask task) Cancels a BukkitTask safely.- Parameters:
task- the task to cancel
-