diff --git a/EXILED/Exiled.API/Features/Server.cs b/EXILED/Exiled.API/Features/Server.cs index 57d1752725..2a99caca10 100644 --- a/EXILED/Exiled.API/Features/Server.cs +++ b/EXILED/Exiled.API/Features/Server.cs @@ -238,6 +238,15 @@ public static bool IsIdleModeEnabled /// public static void Restart() => Round.Restart(false, true, ServerStatic.NextRoundAction.Restart); + /// + /// Restarts the server with specified options. + /// + /// Indicates whether the restart should be fast. + /// Indicates whether to override the default restart action. + /// Specifies the action to perform after the restart. + public static void Restart(bool fastRestart, bool overrideRestartAction = false, ServerStatic.NextRoundAction restartAction = ServerStatic.NextRoundAction.DoNothing) => + Round.Restart(fastRestart, overrideRestartAction, restartAction); + /// /// Shutdowns the server, disconnects all players. /// @@ -266,6 +275,19 @@ public static bool RestartRedirect(ushort redirectPort) return true; } + /// + /// Redirects players to a server on another port, restarts the current server. + /// + /// The port to redirect players to. + /// Indicates whether the restart should be fast. + /// Indicates whether to override the default restart action. + /// Specifies the action to perform after the restart. + public static void RestartRedirect(ushort redirectPort, bool fastRestart, bool overrideRestartAction = false, ServerStatic.NextRoundAction restartAction = ServerStatic.NextRoundAction.DoNothing) + { + NetworkServer.SendToAll(new RoundRestartMessage(RoundRestartType.RedirectRestart, 0.0f, redirectPort, true, false)); + Timing.CallDelayed(0.5f, () => { Restart(fastRestart, overrideRestartAction, restartAction); }); + } + /// /// Redirects players to a server on another port, shutdowns the current server. /// @@ -280,6 +302,18 @@ public static bool ShutdownRedirect(ushort redirectPort) return true; } + /// + /// Redirects players to a server on another port, shutdowns the current server. + /// + /// The port to redirect players to. + /// Indicates whether to terminate the application after shutting down the server. + /// Indicates whether to suppress the broadcast notification about the shutdown. + public static void ShutdownRedirect(ushort redirectPort, bool quit, bool suppressShutdownBroadcast = false) + { + NetworkServer.SendToAll(new RoundRestartMessage(RoundRestartType.RedirectRestart, 0.0f, redirectPort, true, false)); + Timing.CallDelayed(0.5f, () => { Shutdown(quit, suppressShutdownBroadcast); }); + } + /// /// Executes a server command. ///