mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-27 15:30:58 -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 {
|
public sealed partial class ZombieGame {
|
||||||
|
|
||||||
void MainLoop() {
|
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 (Status == ZombieGameStatus.NotStarted) return;
|
||||||
if (!initialChangeLevel) {
|
if (!initialChangeLevel) {
|
||||||
ChooseNextLevel();
|
ChooseNextLevel();
|
||||||
|
@ -215,10 +215,6 @@ namespace MCGalaxy.Games {
|
|||||||
LastLevelName = "";
|
LastLevelName = "";
|
||||||
CurLevelName = "";
|
CurLevelName = "";
|
||||||
CurLevel = null;
|
CurLevel = null;
|
||||||
foreach (Player pl in online) {
|
|
||||||
pl.Game.RatedMap = false;
|
|
||||||
pl.Game.PledgeSurvive = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePlayerStatus(Player p) {
|
void UpdatePlayerStatus(Player p) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user