diff --git a/MCGalaxy/Games/CTF/CtfGame.Round.cs b/MCGalaxy/Games/CTF/CtfGame.Round.cs index 762e05666..fb06d9a17 100644 --- a/MCGalaxy/Games/CTF/CtfGame.Round.cs +++ b/MCGalaxy/Games/CTF/CtfGame.Round.cs @@ -31,13 +31,15 @@ namespace MCGalaxy.Games { if (!Running) return; RoundInProgress = true; - while (Blue.Captures < cfg.RoundPoints && Red.Captures < cfg.RoundPoints) { - if (!Running) return; - if (!RoundInProgress) break; + while (Running && RoundInProgress && !HasSomeoneWon()) { Tick(); Thread.Sleep(300); } } + + bool HasSomeoneWon() { + return Blue.Captures >= cfg.RoundPoints || Red.Captures >= cfg.RoundPoints; + } void Tick() { Player[] online = PlayerInfo.Online.Items; diff --git a/MCGalaxy/Games/TntWars/TWGame.Round.cs b/MCGalaxy/Games/TntWars/TWGame.Round.cs index c30c7d1d3..264f49531 100644 --- a/MCGalaxy/Games/TntWars/TWGame.Round.cs +++ b/MCGalaxy/Games/TntWars/TWGame.Round.cs @@ -94,20 +94,23 @@ namespace MCGalaxy.Games { RoundInProgress = true; MessageMap(CpeMessageType.Announcement, "&4TNT Wars has started!"); - bool won = false; - while (Running && !won) { - if (Config.Mode == TWGameMode.TDM) { - won = Red.Score >= cfg.ScoreRequired || Blue.Score >= cfg.ScoreRequired; - } else { - all = allPlayers.Items; - foreach (Player p in all) { - if (Get(p).Score >= cfg.ScoreRequired) won = true; - } - } + while (Running && RoundInProgress && !HasSomeoneWon()) { Thread.Sleep(250); } } + bool HasSomeoneWon() { + if (Config.Mode == TWGameMode.TDM) { + return Red.Score >= cfg.ScoreRequired || Blue.Score >= cfg.ScoreRequired; + } + + Player[] all = allPlayers.Items; + foreach (Player p in all) { + if (Get(p).Score >= cfg.ScoreRequired) return true; + } + return false; + } + void GracePeriod() { if (!cfg.GracePeriod) return; int duration = (int)cfg.GracePeriodTime.SecondsLong();