From 3f5a76d60bcec28ebe91f31945e99dbcd4fd6622 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Wed, 23 Mar 2022 16:24:33 +0100 Subject: [PATCH] Fix ShowRules command when specifying an amount of seconds. --- Content.Server/Info/ShowRulesCommand.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Content.Server/Info/ShowRulesCommand.cs b/Content.Server/Info/ShowRulesCommand.cs index 5d33f5118e..e523227c81 100644 --- a/Content.Server/Info/ShowRulesCommand.cs +++ b/Content.Server/Info/ShowRulesCommand.cs @@ -15,7 +15,7 @@ public sealed class ShowRulesCommand : IConsoleCommand { public string Command => "showrules"; public string Description => "Opens the rules popup for the specified player."; - public string Help => "showrules [time]"; + public string Help => "showrules [seconds]"; public async void Execute(IConsoleShell shell, string argStr, string[] args) { string target; @@ -32,11 +32,13 @@ public sealed class ShowRulesCommand : IConsoleCommand } case 2: { - if (float.TryParse(args[1], out seconds)) + if (!float.TryParse(args[1], out seconds)) + { + shell.WriteError($"{args[1]} is not a valid amount of seconds.\n{Help}"); return; + } target = args[0]; - shell.WriteLine($"{args[1]} is not a valid amount of minutes.\n{Help}"); break; } default: @@ -54,14 +56,12 @@ public sealed class ShowRulesCommand : IConsoleCommand return; } - var message = new SharedRulesManager.ShowRulesPopupMessage - { - PopupTime = seconds - }; + var netManager = IoCManager.Resolve(); - var player = IoCManager.Resolve() - .GetSessionByUserId(located.UserId); - IoCManager.Resolve() - .ServerSendMessage(message, player.ConnectedClient); + var message = netManager.CreateNetMessage(); + message.PopupTime = seconds; + + var player = IoCManager.Resolve().GetSessionByUserId(located.UserId); + netManager.ServerSendMessage(message, player.ConnectedClient); } }