1 minute estimated read time

Repeatable tasks

Below is an example of a repeatable task that will run on your server’s scheduler (main server thread).
Use repeatable tasks for a more structured way of creating server-synchronous tasks.

The example shown below will be repeated every 1 second.

MyRepeatableTask.java
@VitalRepeatableTask.Info(interval = 1_000)
public class MyRepeatableTask extends VitalRepeatableTask.Spigot {
    public MyRepeatableTask(JavaPlugin plugin) {
        super(plugin);
    }

    @Override
    public void onTick() {
        for (final var player : Bukkit.getOnlinePlayers()) {
            player.sendMessage("Repeatable task tick.");
        }
    }
}

Found an issue?

Help us improve the documentation by reporting typos, missing information, or anything confusing.

Don't worry, we will auto-fill most of the annoying fields.

Create GitHub issue

This site and the Vital framework were built with ❤️ by Mike Neumann