fish-station/Content.Server/Administration/Commands/PardonCommand.cs
Vigers Ray 596698b387
Фикс антаг банов и наказание случайной смерти [ПОРТ] (#1088)
* Antag Bans - traitors

* Added Zombify conversion check for banned, fixed style on ban panel.

* Fix All antag selection on grouprole

* UI updates to show role and antag bans.

* Fix All antag placement

* Prevent Banned players from becoming revs. Added Random Death Smite.

* part 1 PR changes.

* Change appeal instructions to ccvar.

* more readable expirationText logic

* Remove duplicate service setups

* Add helper methods for getting role/antag bans before checking.

* Move Serverside antag Checks in to common methods on ban manager.

* dont allow banned players to return to zombie body after being forced to ghost.

* Move timer stuff in to existing gametick methods.

* Cleaner UI ban check methods

* Handle cases where a ban expires mid round and show new joining players their bans

* Fix a bunch of mismatching time stamps, some were set in UTC, some in local ☠

* Keep the exisiting ban display ui overlay for latejoiners but use the new one in job selection.

* Fix the rev conversion smite, use existing wait period for the end conditions to execute.

* This was already happening.

* Pretty sure the initial passes were false positives on this, no value keeping this on reflection.

* Fix renaming messup from merge conflict.

* Just mock the that the ban isnt real instead of going deeper with the DB stuff.

* Remove double set on cache

* Fix merge conflict

* Adds a border to Oppenhopper poster (#34219)

* border

* Update meta.json

* Update Resources/Textures/Structures/Wallmounts/posters.rsi/meta.json

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>

* Trim trailing newlines from examine messages (#33381)

* Trim trailing newlines from examine messages

* TrimTrailingNewlines -> TrimEnd

* фиксы

* упс

---------

Co-authored-by: Repo <47093363+Titian3@users.noreply.github.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: Spessmann <156740760+Spessmann@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: SpaceManiac <tad@platymuus.com>
2025-01-11 05:07:34 +03:00

60 lines
1.8 KiB
C#

using System.Text;
using Content.Server.Database;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
{
[AdminCommand(AdminFlags.Ban)]
public sealed class PardonCommand : IConsoleCommand
{
public string Command => "pardon";
public string Description => "Pardons somebody's ban";
public string Help => $"Usage: {Command} <ban id>";
public async void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player;
var dbMan = IoCManager.Resolve<IServerDbManager>();
if (args.Length != 1)
{
shell.WriteLine(Help);
return;
}
if (!int.TryParse(args[0], out var banId))
{
shell.WriteLine($"Unable to parse {args[0]} as a ban id integer.\n{Help}");
return;
}
var ban = await dbMan.GetServerBanAsync(banId);
if (ban == null)
{
shell.WriteLine($"No ban found with id {banId}");
return;
}
if (ban.Unban != null)
{
var response = new StringBuilder("This ban has already been pardoned");
if (ban.Unban.UnbanningAdmin != null)
{
response.Append($" by {ban.Unban.UnbanningAdmin.Value}");
}
response.Append($" in {ban.Unban.UnbanTime}.");
shell.WriteLine(response.ToString());
return;
}
await dbMan.AddServerUnbanAsync(new ServerUnbanDef(banId, player?.UserId, DateTimeOffset.UtcNow));
shell.WriteLine($"Pardoned ban with id {banId}");
}
}
}