1 minute estimated read time

Scheduled tasks

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

The example shown below will initially wait 1 second when it starts and then repeat every 5 seconds.

MyComponent.java
@Component
class MyComponent {
  @VitalScheduled(initialDelay = 1, fixedDelay = 5, timeUnit = TimeUnit.SECONDS)
  public void myScheduledTask() {
    for (final var player : Bukkit.getOnlinePlayers()) {
      player.sendMessage("myScheduledTask ticked.");
    }
  }
}

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