public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count != 1) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count)); return; } if (_params[0] == "cancel") { if (!StopServer.stopServerCountingDown) { SdtdConsole.Instance.Output("Stopserver is not running."); } else { StopServer.stopServerCountingDown = false; StopServer.NoEntry = false; if (AutoShutdown.IsEnabled) { AutoShutdown.ShutdownList(); Timers._sD = 0; } Lottery.ShuttingDown = false; SdtdConsole.Instance.Output("Stopserver has been cancelled."); } } else { if (StopServer.stopServerCountingDown) { SdtdConsole.Instance.Output(string.Format("Server is already stopping in {0} mins", Timers._newCount)); } else { if (!int.TryParse(_params[0], out Timers.Stop_Server_Time)) { SdtdConsole.Instance.Output(string.Format("Invalid time specified: {0}", _params[0])); } else { if (Lottery.OpenLotto) { Lottery.StartLotto(); } Lottery.ShuttingDown = true; StopServer.StartShutdown(); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in StopServer.Run: {0}.", e)); } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count != 1) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Wrong number of arguments, expected 1, found {0}", _params.Count)); return; } if (_params[0] == "cancel") { if (!StopServer.ShuttingDown) { SdtdConsole.Instance.Output("[SERVERTOOLS] Stopserver is not running"); } else { StopServer.ShuttingDown = false; StopServer.NoEntry = false; Lottery.ShuttingDown = false; if (Shutdown.IsEnabled) { EventSchedule.Add("Shutdown", DateTime.Now.AddMinutes(Shutdown.Delay)); SdtdConsole.Instance.Output("[SERVERTOOLS] Stopserver has been cancelled and the next shutdown has been reset"); } else { SdtdConsole.Instance.Output("[SERVERTOOLS] Stopserver has been cancelled"); } } } else { if (StopServer.ShuttingDown) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Server is already set to shutdown. Cancel it if you wish to set a new countdown")); } else { if (!int.TryParse(_params[0], out StopServer.Delay)) { SdtdConsole.Instance.Output(string.Format("[SERVERTOOLS] Invalid time specified: {0}", _params[0])); } else { StopServer.StartShutdown(); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in StopServerCommandConsole.Execute: {0}", e.Message)); } }
public override void Execute(List <string> _params, CommandSenderInfo _senderInfo) { try { if (_params.Count != 1) { SdtdConsole.Instance.Output(string.Format("Wrong number of arguments, expected 1, found {0}", _params.Count)); return; } if (_params[0] == "cancel") { if (!StopServer.CountingDown) { SdtdConsole.Instance.Output("Stopserver is not running"); } else { StopServer.CountingDown = false; StopServer.NoEntry = false; Lottery.ShuttingDown = false; if (Shutdown.IsEnabled) { Timers._shutdown = 0; } SdtdConsole.Instance.Output("Stopserver has been cancelled"); } } else { if (StopServer.CountingDown) { SdtdConsole.Instance.Output(string.Format("Server is already set to shutdown")); } else { if (!int.TryParse(_params[0], out StopServer.Delay)) { SdtdConsole.Instance.Output(string.Format("Invalid time specified: {0}", _params[0])); } else { StopServer.StartShutdown(); } } } } catch (Exception e) { Log.Out(string.Format("[SERVERTOOLS] Error in StopServerCommandConsole.Execute: {0}", e.Message)); } }