Permalink
Browse files

Add more auto-start timer announcements.

  • Loading branch information...
1 parent 9cca20a commit f9da8872dd3d8eb7bc797f5c075bb1e686aadb4f @garbagemule garbagemule committed Feb 17, 2013
Showing with 16 additions and 4 deletions.
  1. +16 −4 src/com/garbagemule/MobArena/autostart/AutoStartTimer.java
@@ -45,9 +45,20 @@ public int getRemaining() {
*/
private class Timer implements Runnable {
private int remaining;
+ private int countdownIndex;
+ private int[] intervals = new int[]{1, 2, 3, 4, 5, 10, 30};
private Timer(int seconds) {
- this.remaining = seconds;
+ this.remaining = seconds;
+
+ // Find the first countdown announcement value
+ for (int i = 0; i < intervals.length; i++) {
+ if (seconds > intervals[i]) {
+ countdownIndex = i;
+ } else {
+ break;
+ }
+ }
}
/**
@@ -83,9 +94,10 @@ public void run() {
arena.forceStart();
started = false;
} else {
- // Warn at 5 seconds left
- if (remaining == 5) {
- Messenger.tellAll(arena, Msg.ARENA_AUTO_START, "5");
+ // Warn at x seconds left
+ if (remaining == intervals[countdownIndex]) {
+ Messenger.tellAll(arena, Msg.ARENA_AUTO_START, "" + remaining);
+ countdownIndex--;
}
// Reschedule

0 comments on commit f9da887

Please sign in to comment.