- Fast and efficient.
- Supports both countdowns and timers.
public class ExampleTimer extends Timer {
public ExampleTimer() {
super(TimerType.COUNTDOWN, "Example");
setDuration(TimeUnit.SECONDS.toMillis(10));
}
@Override
public void tick() {
final int minutes = (int) getMinutes(getRemaining());
final int seconds = (int) getSeconds(getRemaining());
Bukkit.broadcastMessage("There is " + minutes + " minutes and " + seconds + " seconds remaining.");
}
@Override
public void onStart() {
Bukkit.broadcastMessage("The countdown has now started");
}
@Override
public void onComplete() {
Bukkit.broadcastMessage("The countdown is now complete!");
}
}