diff --git a/src/me/yaruma/fightsystem/listener/PlayerJoinListener.java b/src/me/yaruma/fightsystem/listener/PlayerJoinListener.java index ce99120..e0d246b 100644 --- a/src/me/yaruma/fightsystem/listener/PlayerJoinListener.java +++ b/src/me/yaruma/fightsystem/listener/PlayerJoinListener.java @@ -7,6 +7,7 @@ import me.yaruma.fightsystem.fight.FightState; import me.yaruma.fightsystem.fight.FightTeam; import me.yaruma.fightsystem.manager.FileManager; import me.yaruma.fightsystem.utils.countdown.Countdown; +import me.yaruma.fightsystem.utils.countdown.CountdownType; import me.yaruma.fightsystem.utils.countdown.FinishSetupOver; import me.yaruma.fightsystem.utils.inventory.SetupItems; import org.bukkit.Bukkit; @@ -71,6 +72,7 @@ public class PlayerJoinListener implements Listener { } if(Fight.getRedTeam().hasTeamLeader() && Fight.getBlueTeam().hasTeamLeader()) { + Countdown.cancelTimerType(CountdownType.NO_PLAYERS_ONLINE); int setupDuration = fileManager.getIntegerFromConfig("Times.SetupDuration"); Countdown countdown = new Countdown(setupDuration, new FinishSetupOver()); countdown.startTimer(instance); diff --git a/src/me/yaruma/fightsystem/utils/countdown/Countdown.java b/src/me/yaruma/fightsystem/utils/countdown/Countdown.java index 5207b38..377088d 100644 --- a/src/me/yaruma/fightsystem/utils/countdown/Countdown.java +++ b/src/me/yaruma/fightsystem/utils/countdown/Countdown.java @@ -58,14 +58,15 @@ public class Countdown { } public static void cancelAllTimers() { - for(Countdown countdown : countdowns) { - countdown.cancelTimer(); + for(int i = countdowns.size() - 1; i >= 0; i--) { + countdowns.get(i).cancelTimer(); } } public static void cancelTimerType(CountdownType countdownType) { - for(Countdown countdown : countdowns) { - if(countdown.getType() == countdownType) countdown.cancelTimer(); + for(int i = countdowns.size() - 1; i >= 0; i--) { + + if(countdowns.get(i).getType() == countdownType) countdowns.get(i).cancelTimer(); } } diff --git a/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java b/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java index a824af6..dc85b75 100644 --- a/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java +++ b/src/me/yaruma/fightsystem/utils/scoreboard/Scoreboard.java @@ -27,7 +27,7 @@ public class Scoreboard { public void setAutoScoreboard(int delay, Player player) { taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(FightSystem.getPlugin(), new Runnable() { - private int index; + private int index = 0; @Override public void run() {