mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-01-27 10:41:19 +01:00
Add more auto-start timer announcements.
This commit is contained in:
parent
9cca20aa92
commit
f9da8872dd
@ -45,9 +45,20 @@ public class AutoStartTimer {
|
||||
*/
|
||||
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;
|
||||
|
||||
// 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 class AutoStartTimer {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user