Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust Shutdown #4198

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Source/ACE.Server/Command/Handlers/AdminShardCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ public static void ShutdownServerNow(Session session, params string[] parameters
"\tSet the shutdown delay in seconds with @set-shutdown-interval < 0-99999 >")]
public static void ShutdownServer(Session session, params string[] parameters)
{
if (ServerManager.ShutdownInitiated)
{
CommandHandlerHelper.WriteOutputInfo(session, "Shutdown is already in progress.", ChatMessageType.Broadcast);
return;
}

var adminText = "";
if (parameters.Length > 0)
adminText = string.Join(" ", parameters);
Expand Down Expand Up @@ -126,7 +132,7 @@ public static void ShutdownServer(Session session, params string[] parameters)
if (adminName.Equals("CONSOLE"))
adminName = "System";

var genericMsgToPlayers = $"Broadcast from {(hideName ? "System": $"{adminName}")}> {(timeTillShutdown.TotalMinutes > 1.5 ? "ATTENTION" : "WARNING")} - This Asheron's Call Server is shutting down in {time}.{(timeTillShutdown.TotalMinutes <= 3 ? " Please log out." : "")}";
var genericMsgToPlayers = $"Broadcast from {(hideName ? "System": $"{adminName}")}> {(timeTillShutdown.TotalMinutes > 1.5 ? "ATTENTION" : "WARNING")} - This Asheron's Call Server will be shutting down in {time}{(sdt.TotalMinutes <= 1 ? "!" : ".")}{(timeTillShutdown.TotalMinutes <= 3 ? $" Please log out{(sdt.TotalMinutes <= 1 ? "!" : ".")}" : "")}";

if (sdt.TotalMilliseconds == 0)
genericMsgToPlayers = $"Broadcast from {(hideName ? "System" : $"{adminName}")}> ATTENTION - This Asheron's Call Server is shutting down NOW!!!!";
Expand Down
4 changes: 2 additions & 2 deletions Source/ACE.Server/Managers/ServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private static DateTime NotifyPlayersOfPendingShutdown(DateTime lastNoticeTime,
{
foreach (var player in PlayerManager.GetAllOnline())
if (sdt.TotalSeconds > 10)
player.Session.WorldBroadcast($"Broadcast from System> {(sdt.TotalMinutes > 1.5 ? "ATTENTION" : "WARNING")} - This Asheron's Call Server is shutting down in {time}.{(sdt.TotalMinutes <= 3 ? " Please log out." : "")}");
player.Session.WorldBroadcast($"Broadcast from System> {(sdt.TotalMinutes > 1.5 ? "ATTENTION" : "WARNING")} - This Asheron's Call Server will be shutting down in {time}{(sdt.TotalMinutes <= 1 ? "!" : ".")}{(sdt.TotalMinutes <= 3 ? $" Please log out{(sdt.TotalMinutes <= 1 ? "!" : ".")}" : "")}");
else
player.Session.WorldBroadcast($"Broadcast from System> ATTENTION - This Asheron's Call Server is shutting down NOW!!!!");

Expand All @@ -297,7 +297,7 @@ public static string ShutdownNoticeText()
timeToShutdown += $"{(timeToShutdown.Length > 0 ? " and " : "")}{(sdt.Seconds > 0 ? $"{sdt.Seconds} second{(sdt.Seconds > 1 ? "s" : "")}" : "")}";

if (sdt.TotalSeconds > 10)
return $"Broadcast from System> {(sdt.TotalMinutes > 1.5 ? "ATTENTION" : "WARNING")} - This Asheron's Call Server is shutting down in {timeToShutdown}.{(sdt.TotalMinutes <= 3 ? " Please log out." : "")}";
return $"Broadcast from System> {(sdt.TotalMinutes > 1.5 ? "ATTENTION" : "WARNING")} - This Asheron's Call Server will be shutting down in {timeToShutdown}{(sdt.TotalMinutes <= 1 ? "!" : ".")}{(sdt.TotalMinutes <= 3 ? $" Please log out{(sdt.TotalMinutes <= 1 ? "!" : ".")}" : "")}";
else
return $"Broadcast from System> ATTENTION - This Asheron's Call Server is shutting down NOW!!!!";
}
Expand Down