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); var ban = await _db.GetServerBanByIpAsync(eventArgs.Connection.RemoteEndPoint.Address);
if (ban != null) if (ban != null)
{ {
var expires = "This is a permanent ban."; var expires = Loc.GetString("ban-banned-permanent");
if (ban.ExpirationTime is { } expireTime) if (ban.ExpirationTime is { } expireTime)
{ {
var duration = expireTime - ban.BanTime; var duration = expireTime - ban.BanTime;
var utc = expireTime.ToUniversalTime(); 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. var reason = Loc.GetString("ban-banned-1") + "\n" + Loc.GetString("ban-banned-2", ("reason", this.Reason)) + "\n" + expires;;
The ban reason is: ""{ban.Reason}""
{expires}";
return NetApproval.Deny(reason); return NetApproval.Deny(reason);
} }

View File

@@ -55,14 +55,15 @@ namespace Content.Server.Database
public string DisconnectMessage public string DisconnectMessage
{ {
get { get {
var expires = "This is a permanent ban."; var expires = Loc.GetString("ban-banned-permanent");
if (this.ExpirationTime is { } expireTime) if (this.ExpirationTime is { } expireTime)
{ {
var duration = expireTime - this.BanTime; var duration = expireTime - this.BanTime;
var utc = expireTime.ToUniversalTime(); var utc = expireTime.ToUniversalTime();
expires = $"This ban is for {duration.TotalMinutes:N0} minutes and will expire at {utc:f} UTC."; expires = Loc.GetString("ban-expires", ("duration", duration.TotalMinutes.ToString("N0")), ("time", utc.ToString("f")));
} }
return $"You, or another user of this computer or connection, are banned from playing here.\nThe ban reason is: \"{this.Reason}\"\n{expires}"; var details = Loc.GetString("ban-banned-1") + "\n" + Loc.GetString("ban-banned-2", ("reason", this.Reason)) + "\n" + expires;
return details;
} }
} }
} }

View File

@@ -16,5 +16,10 @@ command-whitelistremove-not-found = Unable to find '{$username}'
command-kicknonwhitelisted-description = Kicks all non-whitelisted players from the server. command-kicknonwhitelisted-description = Kicks all non-whitelisted players from the server.
command-kicknonwhitelisted-help = kicknonwhitelisted command-kicknonwhitelisted-help = kicknonwhitelisted
ban-banned-permanent = This ban is appeal only.
ban-expires = This ban is for {$duration} minutes and will expire at {$time} UTC.
ban-banned-1 = You, or another user of this computer or connection, are banned from playing here.
ban-banned-2 = The ban reason is: "{$reason}"
soft-player-cap-full = The server is full! soft-player-cap-full = The server is full!
panic-bunker-account-denied = This server is in Panic mode and you were rejected. Contact the server administrator for help. panic-bunker-account-denied = This server is in Panic mode and you were rejected. Contact the server administrator for help.