9386 Permanent ban message change (#11325)

This commit is contained in:
Dylan Corrales
2022-09-15 15:33:11 -04:00
committed by GitHub
parent 165970b58b
commit 4ea7087d6f
3 changed files with 12 additions and 8 deletions

View File

@@ -42,16 +42,14 @@ namespace Content.Server.Connection
var ban = await _db.GetServerBanByIpAsync(eventArgs.Connection.RemoteEndPoint.Address);
if (ban != null)
{
var expires = "This is a permanent ban.";
var expires = Loc.GetString("ban-banned-permanent");
if (ban.ExpirationTime is { } expireTime)
{
var duration = expireTime - ban.BanTime;
var utc = expireTime.ToUniversalTime();
expires = $"This ban is for {duration.TotalMinutes} minutes and will expire at {utc:f} UTC.";
expires = Loc.GetString("ban-expires", ("duration", duration.TotalMinutes.ToString("N0")), ("time", utc.ToString("f")));
}
var reason = $@"You, or another user of this computer or connection is banned from playing here.
The ban reason is: ""{ban.Reason}""
{expires}";
var reason = Loc.GetString("ban-banned-1") + "\n" + Loc.GetString("ban-banned-2", ("reason", this.Reason)) + "\n" + expires;;
return NetApproval.Deny(reason);
}