various thingies
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using LabApi.Loader.Features.Plugins;
|
||||
using LabApi.Features;
|
||||
using LabApi.Events.Handlers;
|
||||
using LabApi.Events.Arguments.PlayerEvents;
|
||||
using LabApi.Features.Console;
|
||||
using MEC;
|
||||
|
||||
namespace VisibleSpectators;
|
||||
|
||||
/// <summary>
|
||||
/// Main entry point for the VisibleSpectators plugin.
|
||||
/// </summary>
|
||||
public class Plugin : Plugin<SpectatorConfig>
|
||||
{
|
||||
private SpectatorManager _spectatorManager;
|
||||
public override string Name => "VisibleSpectators";
|
||||
public override string Author => "Code002Lover";
|
||||
public override Version Version { get; } = new(1, 0, 0);
|
||||
public override string Description => "See your spectators";
|
||||
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Logger.Debug("starting...");
|
||||
_spectatorManager = new SpectatorManager(Config);
|
||||
PlayerEvents.ChangedSpectator += _spectatorManager.OnSpectate;
|
||||
PlayerEvents.Joined += _spectatorManager.OnJoin;
|
||||
Timing.RunCoroutine(_spectatorManager.KeepUpdatingSpectators());
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
Logger.Debug("unloading...");
|
||||
PlayerEvents.Joined -= _spectatorManager.OnJoin;
|
||||
PlayerEvents.ChangedSpectator -= _spectatorManager.OnSpectate;
|
||||
_spectatorManager = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user