mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 23:02:04 -04:00
Unhandled exceptions in zombie survival should not crash the entire server. (Thanks goodlyay)
This commit is contained in:
parent
c03e09b853
commit
95aeffe10e
@ -27,6 +27,21 @@ namespace MCGalaxy.Games {
|
||||
public sealed partial class ZombieGame {
|
||||
|
||||
void MainLoop() {
|
||||
// Make sure that in the worst case, we do not crash the entire server.
|
||||
try {
|
||||
MainLoopCore();
|
||||
} catch (Exception ex) {
|
||||
Server.ErrorLog(ex);
|
||||
Player.GlobalMessage("&cZombie survival disabled due to an error.");
|
||||
try {
|
||||
ResetState();
|
||||
} catch (Exception ex2) {
|
||||
Server.ErrorLog(ex2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainLoopCore() {
|
||||
if (Status == ZombieGameStatus.NotStarted) return;
|
||||
if (!initialChangeLevel) {
|
||||
ChooseNextLevel();
|
||||
|
@ -215,10 +215,6 @@ namespace MCGalaxy.Games {
|
||||
LastLevelName = "";
|
||||
CurLevelName = "";
|
||||
CurLevel = null;
|
||||
foreach (Player pl in online) {
|
||||
pl.Game.RatedMap = false;
|
||||
pl.Game.PledgeSurvive = false;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdatePlayerStatus(Player p) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user