From c2a2f7c1f574f01d671e14dde3fcb925e3ef1783 Mon Sep 17 00:00:00 2001 From: Morbo <14136326+Morb0@users.noreply.github.com> Date: Sat, 3 Dec 2022 14:16:20 +0300 Subject: [PATCH] Revert "Join min playtime (#604)" This reverts commit 2409fea9 --- .../JoinPlayTime/JoinPlayTimeManager.cs | 34 ------------------- Content.Server/Entry/EntryPoint.cs | 2 -- Content.Server/IoC/ServerContentIoC.cs | 2 -- Content.Shared/CCVar/CCVars.cs | 10 ------ .../join-playtime/join-playtime-reason.ftl | 6 ---- 5 files changed, 54 deletions(-) delete mode 100644 Content.Server/Corvax/JoinPlayTime/JoinPlayTimeManager.cs diff --git a/Content.Server/Corvax/JoinPlayTime/JoinPlayTimeManager.cs b/Content.Server/Corvax/JoinPlayTime/JoinPlayTimeManager.cs deleted file mode 100644 index e9f2c47fe5e..00000000000 --- a/Content.Server/Corvax/JoinPlayTime/JoinPlayTimeManager.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Threading.Tasks; -using Content.Server.Database; -using Content.Shared.CCVar; -using Content.Shared.Players.PlayTimeTracking; -using Robust.Shared.Configuration; -using Robust.Shared.Network; - -namespace Content.Server.Corvax.JoinPlayTime; - -public sealed class JoinPlayTimeManager -{ - [Dependency] private readonly INetManager _net = default!; - [Dependency] private readonly IConfigurationManager _cfg = default!; - [Dependency] private readonly IServerDbManager _db = default!; - - private int _minHours = 0; - - public void Initialize() - { - _cfg.OnValueChanged(CCVars.JoinPlaytimeHours, (v) => _minHours = v, true); - - _net.Connecting += OnConnecting; - } - - private async Task OnConnecting(NetConnectingArgs arg) - { - var playTimes = await _db.GetPlayTimes(arg.UserId); - var overallTime = playTimes.Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall); - if (overallTime != null && overallTime.TimeSpent.TotalHours < _minHours) - { - arg.Deny(Loc.GetString("join-playtime-deny-reason", ("hours", _minHours))); - } - } -} diff --git a/Content.Server/Entry/EntryPoint.cs b/Content.Server/Entry/EntryPoint.cs index 54426e127f2..00b8dca3193 100644 --- a/Content.Server/Entry/EntryPoint.cs +++ b/Content.Server/Entry/EntryPoint.cs @@ -5,7 +5,6 @@ using Content.Server.Afk; using Content.Server.Chat.Managers; using Content.Server.Connection; -using Content.Server.Corvax.JoinPlayTime; using Content.Server.Corvax.JoinQueue; using Content.Server.Corvax.Sponsors; using Content.Server.Database; @@ -102,7 +101,6 @@ public override void Init() IoCManager.Resolve().Initialize(); IoCManager.Resolve().Initialize(); // Corvax-Sponsors IoCManager.Resolve().Initialize(); // Corvax-Queue - IoCManager.Resolve().Initialize(); // Corvax-JoinPlaytime IoCManager.Resolve().Initialize(); _voteManager.Initialize(); diff --git a/Content.Server/IoC/ServerContentIoC.cs b/Content.Server/IoC/ServerContentIoC.cs index 7c84878cf7f..bb281f7b777 100644 --- a/Content.Server/IoC/ServerContentIoC.cs +++ b/Content.Server/IoC/ServerContentIoC.cs @@ -5,7 +5,6 @@ using Content.Server.Afk; using Content.Server.Chat.Managers; using Content.Server.Connection; -using Content.Server.Corvax.JoinPlayTime; using Content.Server.Corvax.JoinQueue; using Content.Server.Corvax.Sponsors; using Content.Server.Database; @@ -61,7 +60,6 @@ public static void Register() IoCManager.Register(); IoCManager.Register(); // Corvax-Sponsors IoCManager.Register(); // Corvax-Queue - IoCManager.Register(); // Corvax-JoinPlaytime IoCManager.Register(); } } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index b340abb5663..03723872834 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1426,15 +1426,5 @@ public static readonly CVarDef /// public static readonly CVarDef QueueEnabled = CVarDef.Create("queue.enabled", false, CVar.SERVERONLY); - - /* - * Corvax | JoinPlaytime - */ - - /// - /// Minimum required overall play hours to join server - /// - public static readonly CVarDef JoinPlaytimeHours = - CVarDef.Create("joinplaytime.min_hours", 0, CVar.SERVERONLY); } } diff --git a/Resources/Locale/ru-RU/corvax/join-playtime/join-playtime-reason.ftl b/Resources/Locale/ru-RU/corvax/join-playtime/join-playtime-reason.ftl index 27ba5549f3e..e69de29bb2d 100644 --- a/Resources/Locale/ru-RU/corvax/join-playtime/join-playtime-reason.ftl +++ b/Resources/Locale/ru-RU/corvax/join-playtime/join-playtime-reason.ftl @@ -1,6 +0,0 @@ -join-playtime-deny-reason = - Необходимо минимальное отыгранное время для доступа к серверу - { $hours } { $hours -> - [one] час - [few] часа - *[other] часов - }.