Penalty
A ban, gag or mute on one SteamID. Removed and expired penalties are kept as history.
public sealed record Penalty
Namespace: DeadworksManaged.Api
Source: Admin/Penalties.cs#L28
Properties
Penalty.Id
Identifies this penalty in its store.
Signature
public Guid Id { get; init; }
Source: Admin/Penalties.cs#L31
Penalty.Type
What it stops the player doing.
Signature
public required PenaltyType Type { get; init; }
Source: Admin/Penalties.cs#L33
Penalty.SteamId64
The penalized player.
Signature
public required ulong SteamId64 { get; init; }
Source: Admin/Penalties.cs#L35
Penalty.PlayerName
The player's name when the penalty was added, for display only.
Signature
public string? PlayerName { get; init; }
Source: Admin/Penalties.cs#L37
Penalty.CreatedUtc
When it was added.
Signature
public DateTime CreatedUtc { get; init; } = DateTime.UtcNow;
Source: Admin/Penalties.cs#L39
Penalty.ExpiresUtc
When it runs out, or null for permanent.
Signature
public DateTime? ExpiresUtc { get; init; }
Source: Admin/Penalties.cs#L41
Penalty.Reason
Why it was added.
Signature
public string Reason { get; init; } = "";
Source: Admin/Penalties.cs#L43
Penalty.AdminSteamId64
Who added it, or 0 for the server console.
Signature
public ulong AdminSteamId64 { get; init; }
Source: Admin/Penalties.cs#L45
Penalty.AdminName
The admin's name at the time, for display only.
Signature
public string? AdminName { get; init; }
Source: Admin/Penalties.cs#L47
Penalty.RemovedUtc
When it was lifted early (unban, ungag, ...), or replaced by a newer penalty of the same type.
Signature
public DateTime? RemovedUtc { get; init; }
Source: Admin/Penalties.cs#L49
Penalty.RemovedBySteamId64
Who lifted or replaced it, or 0 for the server console.
Signature
public ulong RemovedBySteamId64 { get; init; }
Source: Admin/Penalties.cs#L51
Penalty.RemovedByName
The name of who lifted or replaced it, for display only; null if it hasn't been.
Signature
public string? RemovedByName { get; init; }
Source: Admin/Penalties.cs#L53
Penalty.RemovalReason
Why it was lifted, if the admin said.
Signature
public string? RemovalReason { get; init; }
Source: Admin/Penalties.cs#L55
Penalty.ReplacedBy
The penalty that replaced this one, if it was replaced rather than lifted.
Signature
public Guid? ReplacedBy { get; init; }
Source: Admin/Penalties.cs#L57
Penalty.IsPermanent
True for a penalty with no end date.
Signature
public bool IsPermanent { get; }
Source: Admin/Penalties.cs#L61
Methods
Penalty.HowEnded()
How it stopped applying by nowUtc, or null if it still applies.
Signature
public PenaltyEnd? HowEnded(DateTime nowUtc)
Source: Admin/Penalties.cs#L64
Penalty.IsActiveAt()
Whether it applies at nowUtc: not lifted and not expired.
Signature
public bool IsActiveAt(DateTime nowUtc)
Source: Admin/Penalties.cs#L75
Penalty.DescribeRemaining()
"permanently", or how long is left, rounded up to the minute and worded like an admin announcement: "for 45 minutes", "for 1 hour", "for 1h 5m", "for 3 days", "for 2d 4h".
Signature
public string DescribeRemaining(DateTime nowUtc)
Source: Admin/Penalties.cs#L81