VitalRepeatableTask
Defines a repeatable task within the Vital framework. A task may perform repeated actions with a set interval.
By default, a repeatable task will not be a Spring bean. That means that Vital will not automatically create an instance of it. This is because repeatable tasks are also meant to be used by vital-minigames, where each instanced-game may have multiple running tasks that are not scoped to the entire server.
A repeatable task can be marked as "autoStart" to automatically start it when a new instance is created. This functionality is disabled by default.
@VitalRepeatableTask.Info(interval = 1_000, autoStart = false)
public class MyRepeatableTask extends VitalRepeatableTask.Spigot {
public MyRepeatableTask(JavaPlugin plugin) {
super(plugin);
}
@Override
public void onTick() {
// ...
}
}Inheritors
Types
Defines the info for a VitalRepeatableTask.
Functions
Cancels the internal runnable for this task.
Cancels the internal task for this task.
Creates the internal runnable for this task.
Creates the internal runnable for this task.
Starts this task if It's not already running. This function will call createRunnable and createTask to set up this task before starting the internal tick timer. The onStart lifecycle function will be called after this task is ready for execution.