From 3d898ed25afccc4fbde2bd8c2e4f9b4709e29987 Mon Sep 17 00:00:00 2001 From: Errant <35878406+Errant-4@users.noreply.github.com> Date: Wed, 12 Mar 2025 06:41:01 +0100 Subject: [PATCH] Roleban command error handling (#35784) roleban command jobid fail handling --- Content.Server/Administration/Commands/RoleBanCommand.cs | 9 +++++++++ 1 file changed, 9 insertions(+) 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) { -- 2.51.2