Skip to content

Timer : Later Sync

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 runLaterSync() {
        // After 5 ticks, callback was called
        timer.runLaterSync(5, () -> {
            Bukkit.broadcastMessage("called after 5 ticks");
        });
    }
}
Clone this wiki locally