package com.acuddlyheadcrab.testplugin; import java.util.Random; import org.bukkit.Bukkit; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; public class TestPlugin extends JavaPlugin implements Listener{ public TestPlugin plugin = this; private int countdown_secs = 0; //hehe secs... sex public void onEnable() { /* this is just used to get a random number between 3 and 13 for demonstration +3 so that we don't have 0 for the countdown */ int rand_seconds = new Random().nextInt(7)+3; System.out.println("Starting countdown"); startCountdown(rand_seconds); } public void onDisable() {} public void startCountdown(final int seconds){ long increment = 20; // just so you know, 1 tick == 1/20 second countdown_secs = seconds; Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { @Override public void run() { // this is where you check if the countdown is done yet if(countdown_secs<1){ Bukkit.getScheduler().cancelTasks(plugin); System.out.println("Boom! Countdown is done!!"); } displayCountdown(); countdown_secs--; } }, increment, increment); } public void displayCountdown() { // put however you want to display the countdown info here int seconds = countdown_secs; System.out.println("Countdown: "+seconds); } }