Panic Bunker uses minutes not hours (#28805)
* Panic Bunker uses minutes not hours * Fixing an instance of hours
This commit is contained in:
committed by
GitHub
parent
50d83b9360
commit
1bb9d9451f
@@ -2,5 +2,5 @@
|
||||
xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.Administration.UI.Tabs.BabyJailTab"
|
||||
Title="{Loc admin-ui-baby-jail-window-title}">
|
||||
<Label Name="MessageLabel" Access="Public" Text="{Loc admin-ui-baby-jail-is-enabled}" />
|
||||
<RichTextLabel Name="MessageLabel" Access="Public" />
|
||||
</controls:BabyJailStatusWindow>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Content.Client.Message;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
@@ -9,10 +11,11 @@ namespace Content.Client.Administration.UI.Tabs.BabyJailTab;
|
||||
*/
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BabyJailStatusWindow : DefaultWindow
|
||||
public sealed partial class BabyJailStatusWindow : FancyWindow
|
||||
{
|
||||
public BabyJailStatusWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
MessageLabel.SetMarkup(Loc.GetString("admin-ui-baby-jail-is-enabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
<BoxContainer Orientation="Horizontal" Margin="2">
|
||||
<Label Text="{Loc admin-ui-panic-bunker-min-account-age}" MinWidth="175" />
|
||||
<LineEdit Name="MinAccountAge" MinWidth="50" Margin="0 0 5 0" />
|
||||
<Label Text="{Loc generic-hours}" />
|
||||
<Label Text="{Loc generic-minutes}" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Horizontal" Margin="2">
|
||||
<Label Text="{Loc admin-ui-panic-bunker-min-overall-hours}" MinWidth="175" />
|
||||
<LineEdit Name="MinOverallHours" MinWidth="50" Margin="0 0 5 0" />
|
||||
<Label Text="{Loc generic-hours}" />
|
||||
<Label Text="{Loc admin-ui-panic-bunker-min-overall-minutes}" MinWidth="175" />
|
||||
<LineEdit Name="MinOverallMinutes" MinWidth="50" Margin="0 0 5 0" />
|
||||
<Label Text="{Loc generic-minutes}" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed partial class PanicBunkerTab : Control
|
||||
[Dependency] private readonly IConsoleHost _console = default!;
|
||||
|
||||
private string _minAccountAge;
|
||||
private string _minOverallHours;
|
||||
private string _minOverallMinutes;
|
||||
|
||||
public PanicBunkerTab()
|
||||
{
|
||||
@@ -25,9 +25,9 @@ public sealed partial class PanicBunkerTab : Control
|
||||
MinAccountAge.OnFocusExit += args => SendMinAccountAge(args.Text);
|
||||
_minAccountAge = MinAccountAge.Text;
|
||||
|
||||
MinOverallHours.OnTextEntered += args => SendMinOverallHours(args.Text);
|
||||
MinOverallHours.OnFocusExit += args => SendMinOverallHours(args.Text);
|
||||
_minOverallHours = MinOverallHours.Text;
|
||||
MinOverallMinutes.OnTextEntered += args => SendMinOverallMinutes(args.Text);
|
||||
MinOverallMinutes.OnFocusExit += args => SendMinOverallMinutes(args.Text);
|
||||
_minOverallMinutes = MinOverallMinutes.Text;
|
||||
}
|
||||
|
||||
private void SendMinAccountAge(string text)
|
||||
@@ -42,16 +42,16 @@ public sealed partial class PanicBunkerTab : Control
|
||||
_console.ExecuteCommand($"panicbunker_min_account_age {minutes}");
|
||||
}
|
||||
|
||||
private void SendMinOverallHours(string text)
|
||||
private void SendMinOverallMinutes(string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text) ||
|
||||
text == _minOverallHours ||
|
||||
!int.TryParse(text, out var hours))
|
||||
text == _minOverallMinutes ||
|
||||
!int.TryParse(text, out var minutes))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_console.ExecuteCommand($"panicbunker_min_overall_hours {hours}");
|
||||
_console.ExecuteCommand($"panicbunker_min_overall_minutes {minutes}");
|
||||
}
|
||||
|
||||
public void UpdateStatus(PanicBunkerStatus status)
|
||||
@@ -68,10 +68,10 @@ public sealed partial class PanicBunkerTab : Control
|
||||
CountDeadminnedButton.Pressed = status.CountDeadminnedAdmins;
|
||||
ShowReasonButton.Pressed = status.ShowReason;
|
||||
|
||||
MinAccountAge.Text = status.MinAccountAgeHours.ToString();
|
||||
MinAccountAge.Text = status.MinAccountAgeMinutes.ToString();
|
||||
_minAccountAge = MinAccountAge.Text;
|
||||
|
||||
MinOverallHours.Text = status.MinOverallHours.ToString();
|
||||
_minOverallHours = MinOverallHours.Text;
|
||||
MinOverallMinutes.Text = status.MinOverallMinutes.ToString();
|
||||
_minOverallMinutes = MinOverallMinutes.Text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public sealed class PanicBunkerMinAccountAgeCommand : LocalizedCommands
|
||||
if (args.Length == 0)
|
||||
{
|
||||
var current = _cfg.GetCVar(CCVars.PanicBunkerMinAccountAge);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-min-account-age-is", ("hours", current / 60)));
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-min-account-age-is", ("minutes", current)));
|
||||
}
|
||||
|
||||
if (args.Length > 1)
|
||||
@@ -148,30 +148,30 @@ public sealed class PanicBunkerMinAccountAgeCommand : LocalizedCommands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var hours))
|
||||
if (!int.TryParse(args[0], out var minutes))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-argument-must-be-number"));
|
||||
return;
|
||||
}
|
||||
|
||||
_cfg.SetCVar(CCVars.PanicBunkerMinAccountAge, hours * 60);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-min-account-age-set", ("hours", hours)));
|
||||
_cfg.SetCVar(CCVars.PanicBunkerMinAccountAge, minutes);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-min-account-age-set", ("minutes", minutes)));
|
||||
}
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Server)]
|
||||
public sealed class PanicBunkerMinOverallHoursCommand : LocalizedCommands
|
||||
public sealed class PanicBunkerMinOverallMinutesCommand : LocalizedCommands
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public override string Command => "panicbunker_min_overall_hours";
|
||||
public override string Command => "panicbunker_min_overall_minutes";
|
||||
|
||||
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
var current = _cfg.GetCVar(CCVars.PanicBunkerMinOverallHours);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-min-overall-hours-is", ("minutes", current)));
|
||||
var current = _cfg.GetCVar(CCVars.PanicBunkerMinOverallMinutes);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-min-overall-minutes-is", ("minutes", current)));
|
||||
}
|
||||
|
||||
if (args.Length > 1)
|
||||
@@ -180,13 +180,13 @@ public sealed class PanicBunkerMinOverallHoursCommand : LocalizedCommands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!int.TryParse(args[0], out var hours))
|
||||
if (!int.TryParse(args[0], out var minutes))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-argument-must-be-number"));
|
||||
return;
|
||||
}
|
||||
|
||||
_cfg.SetCVar(CCVars.PanicBunkerMinOverallHours, hours);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-overall-hours-age-set", ("hours", hours)));
|
||||
_cfg.SetCVar(CCVars.PanicBunkerMinOverallMinutes, minutes);
|
||||
shell.WriteLine(Loc.GetString("panicbunker-command-overall-minutes-age-set", ("minutes", minutes)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public sealed partial class ServerApi : IPostInjectInit
|
||||
CCVars.PanicBunkerCountDeadminnedAdmins.Name,
|
||||
CCVars.PanicBunkerShowReason.Name,
|
||||
CCVars.PanicBunkerMinAccountAge.Name,
|
||||
CCVars.PanicBunkerMinOverallHours.Name,
|
||||
CCVars.PanicBunkerMinOverallMinutes.Name,
|
||||
CCVars.PanicBunkerCustomReason.Name,
|
||||
];
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Content.Server.Administration.Systems
|
||||
Subs.CVar(_config, CCVars.PanicBunkerCountDeadminnedAdmins, OnPanicBunkerCountDeadminnedAdminsChanged, true);
|
||||
Subs.CVar(_config, CCVars.PanicBunkerShowReason, OnPanicBunkerShowReasonChanged, true);
|
||||
Subs.CVar(_config, CCVars.PanicBunkerMinAccountAge, OnPanicBunkerMinAccountAgeChanged, true);
|
||||
Subs.CVar(_config, CCVars.PanicBunkerMinOverallHours, OnPanicBunkerMinOverallHoursChanged, true);
|
||||
Subs.CVar(_config, CCVars.PanicBunkerMinOverallMinutes, OnPanicBunkerMinOverallMinutesChanged, true);
|
||||
|
||||
/*
|
||||
* TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
|
||||
@@ -304,7 +304,7 @@ namespace Content.Server.Administration.Systems
|
||||
|
||||
private void OnPanicBunkerMinAccountAgeChanged(int minutes)
|
||||
{
|
||||
PanicBunker.MinAccountAgeHours = minutes / 60;
|
||||
PanicBunker.MinAccountAgeMinutes = minutes;
|
||||
SendPanicBunkerStatusAll();
|
||||
}
|
||||
|
||||
@@ -314,9 +314,9 @@ namespace Content.Server.Administration.Systems
|
||||
SendBabyJailStatusAll();
|
||||
}
|
||||
|
||||
private void OnPanicBunkerMinOverallHoursChanged(int hours)
|
||||
private void OnPanicBunkerMinOverallMinutesChanged(int minutes)
|
||||
{
|
||||
PanicBunker.MinOverallHours = hours;
|
||||
PanicBunker.MinOverallMinutes = minutes;
|
||||
SendPanicBunkerStatusAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -186,9 +186,9 @@ namespace Content.Server.Connection
|
||||
("reason", Loc.GetString("panic-bunker-account-reason-account", ("minutes", minMinutesAge)))), null);
|
||||
}
|
||||
|
||||
var minOverallHours = _cfg.GetCVar(CCVars.PanicBunkerMinOverallHours);
|
||||
var minOverallMinutes = _cfg.GetCVar(CCVars.PanicBunkerMinOverallMinutes);
|
||||
var overallTime = ( await _db.GetPlayTimes(e.UserId)).Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall);
|
||||
var haveMinOverallTime = overallTime != null && overallTime.TimeSpent.TotalHours > minOverallHours;
|
||||
var haveMinOverallTime = overallTime != null && overallTime.TimeSpent.TotalMinutes > minOverallMinutes;
|
||||
|
||||
// Use the custom reason if it exists & they don't have the minimum time
|
||||
if (customReason != string.Empty && !haveMinOverallTime && !bypassAllowed)
|
||||
@@ -200,7 +200,7 @@ namespace Content.Server.Connection
|
||||
{
|
||||
return (ConnectionDenyReason.Panic,
|
||||
Loc.GetString("panic-bunker-account-denied-reason",
|
||||
("reason", Loc.GetString("panic-bunker-account-reason-overall", ("hours", minOverallHours)))), null);
|
||||
("reason", Loc.GetString("panic-bunker-account-reason-overall", ("minutes", minOverallMinutes)))), null);
|
||||
}
|
||||
|
||||
if (!validAccountAge || !haveMinOverallTime && !bypassAllowed)
|
||||
|
||||
@@ -10,8 +10,8 @@ public sealed class PanicBunkerStatus
|
||||
public bool EnableWithoutAdmins;
|
||||
public bool CountDeadminnedAdmins;
|
||||
public bool ShowReason;
|
||||
public int MinAccountAgeHours;
|
||||
public int MinOverallHours;
|
||||
public int MinAccountAgeMinutes;
|
||||
public int MinOverallMinutes;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -304,8 +304,8 @@ namespace Content.Shared.CCVar
|
||||
/// <summary>
|
||||
/// Minimal overall played time.
|
||||
/// </summary>
|
||||
public static readonly CVarDef<int> PanicBunkerMinOverallHours =
|
||||
CVarDef.Create("game.panic_bunker.min_overall_hours", 10, CVar.SERVERONLY);
|
||||
public static readonly CVarDef<int> PanicBunkerMinOverallMinutes =
|
||||
CVarDef.Create("game.panic_bunker.min_overall_minutes", 600, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// A custom message that will be used for connections denied to the panic bunker
|
||||
|
||||
@@ -23,12 +23,12 @@ cmd-panicbunker_show_reason-help = Usage: panicbunker_show_reason
|
||||
panicbunker-command-show-reason-enabled = The panic bunker will now show a reason to users it blocks from connecting.
|
||||
panicbunker-command-show-reason-disabled = The panic bunker will no longer show a reason to users it blocks from connecting.
|
||||
|
||||
cmd-panicbunker_min_account_age-desc = Gets or sets the minimum account age in hours that an account must have to be allowed to connect with the panic bunker enabled.
|
||||
cmd-panicbunker_min_account_age-help = Usage: panicbunker_min_account_age <hours>
|
||||
panicbunker-command-min-account-age-is = The minimum account age for the panic bunker is {$hours} hours.
|
||||
panicbunker-command-min-account-age-set = Set the minimum account age for the panic bunker to {$hours} hours.
|
||||
cmd-panicbunker_min_account_age-desc = Gets or sets the minimum account age in minutes that an account must have to be allowed to connect with the panic bunker enabled.
|
||||
cmd-panicbunker_min_account_age-help = Usage: panicbunker_min_account_age <minutes>
|
||||
panicbunker-command-min-account-age-is = The minimum account age for the panic bunker is {$minutes} minutes.
|
||||
panicbunker-command-min-account-age-set = Set the minimum account age for the panic bunker to {$minutes} minutes.
|
||||
|
||||
cmd-panicbunker_min_overall_hours-desc = Gets or sets the minimum overall playtime in hours that an account must have to be allowed to connect with the panic bunker enabled.
|
||||
cmd-panicbunker_min_overall_hours-help = Usage: panicbunker_min_overall_hours <hours>
|
||||
panicbunker-command-min-overall-hours-is = The minimum overall playtime for the panic bunker is {$hours} hours.
|
||||
panicbunker-command-min-overall-hours-set = Set the minimum overall playtime for the panic bunker to {$hours} hours.
|
||||
cmd-panicbunker_min_overall_minutes-desc = Gets or sets the minimum overall playtime in minutes that an account must have to be allowed to connect with the panic bunker enabled.
|
||||
cmd-panicbunker_min_overall_minutes-help = Usage: panicbunker_min_overall_minutes <minutes>
|
||||
panicbunker-command-min-overall-minutes-is = The minimum overall playtime for the panic bunker is {$minutes} minutes.
|
||||
panicbunker-command-min-overall-minutes-set = Set the minimum overall playtime for the panic bunker to {$minutes} minutes.
|
||||
|
||||
@@ -10,7 +10,7 @@ admin-ui-baby-jail-show-reason-tooltip = Show the user why they were blocked fro
|
||||
admin-ui-baby-jail-max-account-age = Max. Account Age
|
||||
admin-ui-baby-jail-max-overall-minutes = Max. Overall Playtime
|
||||
|
||||
admin-ui-baby-jail-is-enabled = The baby jail is currently enabled.
|
||||
admin-ui-baby-jail-is-enabled = [font size=20][bold]The baby jail is currently enabled.[/bold][/font]
|
||||
|
||||
admin-ui-baby-jail-enabled-admin-alert = The baby jail has been enabled.
|
||||
admin-ui-baby-jail-disabled-admin-alert = The baby jail has been disabled.
|
||||
|
||||
@@ -16,7 +16,7 @@ admin-ui-panic-bunker-show-reason = Show Reason
|
||||
admin-ui-panic-bunker-show-reason-tooltip = Show the user why they were blocked from connecting by the panic bunker.
|
||||
|
||||
admin-ui-panic-bunker-min-account-age = Min. Account Age
|
||||
admin-ui-panic-bunker-min-overall-hours = Min. Overall Playtime
|
||||
admin-ui-panic-bunker-min-overall-minutes = Min. Overall Playtime
|
||||
|
||||
admin-ui-panic-bunker-is-enabled = The panic bunker is currently enabled.
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ soft-player-cap-full = The server is full!
|
||||
panic-bunker-account-denied = This server is in panic bunker mode, often enabled as a precaution against raids. New connections by accounts not meeting certain requirements are temporarily not accepted. Try again later
|
||||
panic-bunker-account-denied-reason = This server is in panic bunker mode, often enabled as a precaution against raids. New connections by accounts not meeting certain requirements are temporarily not accepted. Try again later. Reason: "{$reason}"
|
||||
panic-bunker-account-reason-account = Your Space Station 14 account is too new. It must be older than {$minutes} minutes
|
||||
panic-bunker-account-reason-overall = Your overall playtime on the server must be greater than {$hours} hours
|
||||
panic-bunker-account-reason-overall = Your overall playtime on the server must be greater than {$minutes} $minutes
|
||||
|
||||
baby-jail-account-denied = This server is a newbie server, intended for new players and those who want to help them. New connections by accounts that are too old or are not on a whitelist are not accepted. Check out some other servers and see everything Space Station 14 has to offer. Have fun!
|
||||
baby-jail-account-denied-reason = This server is a newbie server, intended for new players and those who want to help them. New connections by accounts that are too old or are not on a whitelist are not accepted. Check out some other servers and see everything Space Station 14 has to offer. Have fun! Reason: "{$reason}"
|
||||
baby-jail-account-reason-account = Your Space Station 14 account is too old. It must be younger than {$minutes} minutes
|
||||
baby-jail-account-reason-overall = Your overall playtime on the server must be younger than {$hours} hours
|
||||
baby-jail-account-reason-overall = Your overall playtime on the server must be younger than {$minutes} $minutes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user