Add department bans (#11085)

* Add department bans

Also localised some stuff while I was there.

* loc
This commit is contained in:
metalgearsloth
2022-09-09 08:06:21 +10:00
committed by GitHub
parent 6f5e22a999
commit 72bc05e3ac
4 changed files with 107 additions and 12 deletions

View File

@@ -102,7 +102,7 @@ public sealed class RoleBanManager
{
if (!_prototypeManager.TryIndex(job, out JobPrototype? _))
{
shell.WriteLine($"Job {job} does not exist.");
shell.WriteError(Loc.GetString("cmd-roleban-job-parse", ("job", job)));
return;
}
@@ -127,7 +127,7 @@ public sealed class RoleBanManager
var located = await _playerLocator.LookupIdByNameOrIdAsync(target);
if (located == null)
{
shell.WriteError("Unable to find a player with that name.");
shell.WriteError(Loc.GetString("cmd-roleban-name-parse"));
return;
}
@@ -167,17 +167,12 @@ public sealed class RoleBanManager
if (!await AddRoleBan(banDef))
{
shell.WriteLine($"{target} already has a role ban for {role}");
shell.WriteLine(Loc.GetString("cmd-roleban-existing", ("target", target), ("role", role)));
return;
}
var response = new StringBuilder($"Role banned {target} with reason \"{reason}\"");
response.Append(expires == null ?
" permanently."
: $" until {expires}");
shell.WriteLine(response.ToString());
var length = expires == null ? Loc.GetString("cmd-roleban-inf") : Loc.GetString("cmd-roleban-until", ("expires", expires));
shell.WriteLine(Loc.GetString("cmd-roleban-success", ("target", target), ("role", role), ("reason", reason), ("length", length)));
}
#endregion
}