From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Wed, 12 Mar 2025 05:41:01 +0000 (+0100) Subject: Roleban command error handling (#35784) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3d898ed25afccc4fbde2bd8c2e4f9b4709e29987;p=space-station-14.git Roleban command error handling (#35784) roleban command jobid fail handling --- diff --git a/Content.Server/Administration/Commands/RoleBanCommand.cs b/Content.Server/Administration/Commands/RoleBanCommand.cs index 8b535977ee..68fbac0334 100644 --- a/Content.Server/Administration/Commands/RoleBanCommand.cs +++ b/Content.Server/Administration/Commands/RoleBanCommand.cs @@ -7,6 +7,8 @@ using Content.Shared.Database; using Content.Shared.Roles; using Robust.Shared.Configuration; using Robust.Shared.Console; +using Robust.Shared.Prototypes; + namespace Content.Server.Administration.Commands; [AdminCommand(AdminFlags.Ban)] @@ -15,6 +17,7 @@ public sealed class RoleBanCommand : IConsoleCommand [Dependency] private readonly IPlayerLocator _locator = default!; [Dependency] private readonly IBanManager _bans = default!; [Dependency] private readonly IConfigurationManager _cfg = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; public string Command => "roleban"; public string Description => Loc.GetString("cmd-roleban-desc"); @@ -76,6 +79,12 @@ public sealed class RoleBanCommand : IConsoleCommand return; } + if (!_proto.HasIndex(job)) + { + shell.WriteError(Loc.GetString("cmd-roleban-job-parse",("job", job))); + return; + } + var located = await _locator.LookupIdByNameOrIdAsync(target); if (located == null) {