public static void Restart(Sender sender, Server server) { if (sender is Player) { Player player = ((Player)sender); if (!player.Op) { player.sendMessage("You Cannot Perform That Action.", 255, 238f, 130f, 238f); return; } } Statics.keepRunning = true; server.StopServer(); while (Statics.serverStarted); Program.tConsole.WriteLine("Starting the Server"); server.Initialize(); WorldGen.loadWorld(); server.StartServer(); Program.updateThread = new Thread(Program.Updater); Statics.keepRunning = false; }
public static void Exit(Server server) { server.StopServer(); }
/// <summary> /// Closes the Server all connections. /// </summary> /// <param name="server">Current Server instance</param> /// <param name="sender">Sending player</param> /// <param name="args">Arguments sent with command</param> public static void Exit(Server server, ISender sender, ArgumentList args) { if (sender is Player) // || sender is RConSender) //Requested for Rcon Users. { sender.sendMessage("You cannot perform that action.", 255, 238, 130, 238); return; } args.ParseNone(); server.notifyOps("Exiting on request.", true); server.StopServer(); return; }
/// <summary> /// Restarts the server /// </summary> /// <param name="server">Current Server instance</param> /// <param name="sender">Sending player</param> /// <param name="args">Arguments sent with command</param> public static void Restart(Server server, ISender sender, ArgumentList args) { server.notifyOps("Restarting the Server {" + sender.Name + "}", true); Statics.keepRunning = true; server.StopServer(); while (Statics.serverStarted) { Thread.Sleep(10); } ProgramLog.Log("Starting the Server"); server.Initialize(); WorldIO.loadWorld(); Program.updateThread = new ProgramThread ("Updt", Program.UpdateLoop); server.StartServer(); Statics.keepRunning = false; }
/// <summary> /// Executes the save/stop routine for the server /// </summary> /// <param name="server">Current instance of Server to stop</param> /// <param name="sender">Player/Console instance</param> public static void Exit(Server server, ISender sender) { if (sender is Player) { Player player = (Player)sender; if (!player.Op) { player.sendMessage("You Cannot Perform That Action.", 255, 238f, 130f, 238f); return; } } Program.server.notifyOps("Stopping Server..."); server.StopServer(); }