public void ErrorStop(Exception e, bool sendExceptionMessage = false) { this.Logger = new Logger(); Logger.Fatal(e.ToString()); Logger.Error("%server_stop_error"); Logger.Info("%server_stop"); this.mineNETConfig?.Save <MineNETConfig>(); this.serverConfig?.Save <ServerConfig>(); Player[] players = this.GetPlayers(); if (players != null) { for (int i = 0; i < players.Length; ++i) { if (sendExceptionMessage) { players[i].Close(e.ToString()); } else { players[i].Close(this.mineNETConfig.ServerStopText); } } } this.UnloadWorld(); this.NetworkManager?.Server?.UDPClientClose(); ServerEvents.OnServerStop(new ServerStopEventArgs()); this.Kill(); }
public void Stop(string reason = "") { Logger.Info("%server_stop"); this.mineNETConfig.Save <MineNETConfig>(); this.serverConfig.Save <ServerConfig>(); Player[] players = this.GetPlayers(); for (int i = 0; i < players.Length; ++i) { if (string.IsNullOrEmpty(reason)) { players[i].Close(this.mineNETConfig.ServerStopText); } else { players[i].Close(reason); } } this.PluginManager.DisablePlugins(); this.UnloadWorld(); this.NetworkManager.Server.UDPClientClose(); ServerEvents.OnServerStop(new ServerStopEventArgs()); this.Kill(); }