Add Template, more custom classes & fix issues
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user