Skip to content

Timer : Later Async

Xenxia edited this page Feb 27, 2021 · 1 revision
import fr.cheeseGrinder.bukkitTimer.Timer;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class TestTimer {
    private final Timer timer;

    public TestTimer(JavaPlugin plugin) {
        this.timer = new Timer(plugin);

        // you can also set a default template for formatting the time.
        this.timer = new Timer(plugin, "0.0");
    }

    public void runLaterAsync() {
        // After 5 seconds callback was called
        timer.runLaterAsync(5 * 20, () -> {
            Bukkit.broadcastMessage("called after 5 seconds");
        });
    }
}

Clone this wiki locally