diff --git a/SCPTeamHint/SCPTeamHint.cs b/SCPTeamHint/SCPTeamHint.cs index f4a3375..19023a8 100644 --- a/SCPTeamHint/SCPTeamHint.cs +++ b/SCPTeamHint/SCPTeamHint.cs @@ -6,11 +6,11 @@ using LabApi.Events.Handlers; using LabApi.Features; using LabApi.Features.Console; using LabApi.Features.Wrappers; +using MEC; using PlayerRoles; using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp096; using PlayerRoles.PlayableScps.Scp3114; -using Timer = System.Timers.Timer; namespace SCPTeamHint; @@ -19,7 +19,6 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin private readonly object _hintsLock = new(); private readonly Dictionary _spectatorHints = new(); - private Timer _timer; public override string Name => "SCPTeamHint"; public override string Author => "HoherGeist, Code002Lover"; public override Version Version { get; } = new(1, 0, 0); @@ -32,18 +31,13 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin PlayerEvents.Joined += OnJoin; PlayerEvents.Left += OnLeft; - _timer = new Timer(1000); - _timer.Elapsed += (_, _) => UpdateHints(); - _timer.Start(); + Timing.CallContinuously(1, UpdateHints); } public override void Disable() { PlayerEvents.Joined -= OnJoin; PlayerEvents.Left -= OnLeft; - _timer?.Stop(); - _timer?.Dispose(); - _timer = null; } private void UpdateHints() diff --git a/SCPTeamHint/SCPTeamHint.csproj b/SCPTeamHint/SCPTeamHint.csproj index 18fe8db..3c133ee 100644 --- a/SCPTeamHint/SCPTeamHint.csproj +++ b/SCPTeamHint/SCPTeamHint.csproj @@ -29,6 +29,9 @@ ..\dependencies\Assembly-CSharp.dll + + ..\dependencies\Assembly-CSharp-firstpass.dll + ..\dependencies\HintServiceMeow-LabAPI.dll diff --git a/VisibleSpectators/VisibleSpectators.cs b/VisibleSpectators/VisibleSpectators.cs index 5a77a8e..2dbf2d4 100644 --- a/VisibleSpectators/VisibleSpectators.cs +++ b/VisibleSpectators/VisibleSpectators.cs @@ -7,8 +7,8 @@ using LabApi.Features; using LabApi.Features.Console; using LabApi.Features.Wrappers; using LabApi.Loader.Features.Plugins; +using MEC; using PlayerRoles; -using Timer = System.Timers.Timer; namespace VisibleSpectators; @@ -51,7 +51,6 @@ public class Plugin : Plugin }; private readonly Dictionary _spectatorHints = new(); - private Timer _timer; public override string Name => "VisibleSpectators"; public override string Author => "Code002Lover"; public override Version Version { get; } = new(1, 0, 0); @@ -68,19 +67,13 @@ public class Plugin : Plugin PlayerEvents.ChangedSpectator += OnSpectate; PlayerEvents.Joined += OnJoin; - _timer = new Timer(1000); - _timer.Elapsed += (_, _) => UpdateSpectators(); - _timer.Start(); + Timing.CallContinuously(1, UpdateSpectators); } public override void Disable() { Logger.Debug("unloading..."); - _timer.Stop(); - _timer.Dispose(); - _timer = null; - PlayerEvents.Joined -= OnJoin; PlayerEvents.ChangedSpectator -= OnSpectate; diff --git a/VisibleSpectators/VisibleSpectators.csproj b/VisibleSpectators/VisibleSpectators.csproj index 8b311cd..29d0ac6 100644 --- a/VisibleSpectators/VisibleSpectators.csproj +++ b/VisibleSpectators/VisibleSpectators.csproj @@ -23,6 +23,9 @@ ..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll + + ..\dependencies\Assembly-CSharp-firstpass.dll + ..\dependencies\HintServiceMeow-LabAPI.dll