mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-04 02:52:21 -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;
|
if (!Running) return;
|
||||||
|
|
||||||
RoundInProgress = true;
|
RoundInProgress = true;
|
||||||
while (Blue.Captures < cfg.RoundPoints && Red.Captures < cfg.RoundPoints) {
|
while (Running && RoundInProgress && !HasSomeoneWon()) {
|
||||||
if (!Running) return;
|
|
||||||
if (!RoundInProgress) break;
|
|
||||||
Tick();
|
Tick();
|
||||||
Thread.Sleep(300);
|
Thread.Sleep(300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasSomeoneWon() {
|
||||||
|
return Blue.Captures >= cfg.RoundPoints || Red.Captures >= cfg.RoundPoints;
|
||||||
|
}
|
||||||
|
|
||||||
void Tick() {
|
void Tick() {
|
||||||
Player[] online = PlayerInfo.Online.Items;
|
Player[] online = PlayerInfo.Online.Items;
|
||||||
|
@ -94,20 +94,23 @@ namespace MCGalaxy.Games {
|
|||||||
RoundInProgress = true;
|
RoundInProgress = true;
|
||||||
MessageMap(CpeMessageType.Announcement, "&4TNT Wars has started!");
|
MessageMap(CpeMessageType.Announcement, "&4TNT Wars has started!");
|
||||||
|
|
||||||
bool won = false;
|
while (Running && RoundInProgress && !HasSomeoneWon()) {
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Thread.Sleep(250);
|
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() {
|
void GracePeriod() {
|
||||||
if (!cfg.GracePeriod) return;
|
if (!cfg.GracePeriod) return;
|
||||||
int duration = (int)cfg.GracePeriodTime.SecondsLong();
|
int duration = (int)cfg.GracePeriodTime.SecondsLong();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user