排程程式重複任務

計劃任務的時間以 Ticks 衡量。在正常情況下,每秒有 20 個滴答。

使用 .scheduleSyncRepeatingTask 安排的任務將在主執行緒上執行

Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
    @Override
    public void run() {
        Bukkit.broadcastMessage("This message is shown immediately and then repeated every second");
    }
}, 0L, 20L); //0 Tick initial delay, 20 Tick (1 Second) between repeats