-
Notifications
You must be signed in to change notification settings - Fork 0
1.7. Runnables
Karol Gajda edited this page Apr 25, 2023
·
2 revisions
OpRunnable public class OpRunnable extends BukkitRunnable implements Serializable
The OpRunnable class is a Bukkit Runnable implementation that allows for easy scheduling and execution of tasks in a Minecraft plugin. It extends the BukkitRunnable class and implements Serializable interface, allowing for serialization and deserialization of instances of this class.
Constructors
OpRunnable(Consumer<OpRunnable> consumer): Constructs a new OpRunnable with the specified Consumer<OpRunnable> as the task to be executed.
OpRunnable(Runnable runnable): Constructs a new OpRunnable with the specified Runnable as the task to be executed. The Runnable is wrapped into a Consumer<OpRunnable> internally.
Static Method
static @NotNull OpRunnable get(Consumer<OpRunnable> consumer): Returns a new OpRunnable instance with the specified Consumer<OpRunnable> as the task to be executed.
Methods
OpRunnable set(Consumer<OpRunnable> consumer): Sets the Consumer<OpRunnable> as the task to be executed by this OpRunnable instance.
boolean cancelTask(): Cancels the Bukkit task associated with this OpRunnable instance, if it is not already cancelled. Returns true if the task was cancelled, false otherwise.
@NotNull OpRunnable runTaskLaterAsynchronously(long delay): Schedules this OpRunnable instance to run asynchronously after the specified delay (in ticks) using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTask(): Schedules this OpRunnable instance to run synchronously using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTaskLater(long delay): Schedules this OpRunnable instance to run synchronously after the specified delay (in ticks) using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTaskTimerAsynchronously(long delay, long period): Schedules this OpRunnable instance to run asynchronously with a specified delay (in ticks) and period (in ticks) using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTaskTimerAsynchronously(long delay): Schedules this OpRunnable instance to run asynchronously with a specified delay (in ticks) and same period as delay using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTaskTimer(long delay, long period): Schedules this OpRunnable instance to run synchronously with a specified delay (in ticks) and period (in ticks) using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTaskTimer(long delay): Schedules this OpRunnable instance to run synchronously with a specified delay (in ticks) and same period as delay using the Bukkit scheduler. Returns the same OpRunnable instance for method chaining.
@NotNull OpRunnable runTaskAsynchronously(): Schedules this OpRunnable instance to run asynchronously using the Bukkit scheduler.
If you are stuck with something, have any ideas, want to improve anything or tell me anything, don't hesitate to DM me on discord: KarolGajda#5694.