mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-02 10:01:34 -04:00
Fix /tw end not working
This commit is contained in:
parent
4a5a79afa4
commit
b917fa3d95
@ -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;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user