Add Template, more custom classes & fix issues

This commit is contained in:
2025-06-08 00:54:06 +02:00
parent c9bee028d9
commit 73a4da1edd
9 changed files with 466 additions and 53 deletions
+9 -2
View File
@@ -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,6 +51,7 @@ public class Plugin : Plugin<SpectatorConfig>
};
private readonly Dictionary<Player, Hint> _spectatorHints = new();
private Timer _timer;
public override string Name => "VisibleSpectators";
public override string Author => "Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
@@ -67,13 +68,19 @@ public class Plugin : Plugin<SpectatorConfig>
PlayerEvents.ChangedSpectator += OnSpectate;
PlayerEvents.Joined += OnJoin;
Timing.CallContinuously(1, UpdateSpectators);
_timer = new Timer(1000);
_timer.Elapsed += (_, _) => UpdateSpectators();
_timer.Start();
}
public override void Disable()
{
Logger.Debug("unloading...");
_timer.Stop();
_timer.Dispose();
_timer = null;
PlayerEvents.Joined -= OnJoin;
PlayerEvents.ChangedSpectator -= OnSpectate;