using LabApi.Events.Handlers; using LabApi.Features; using LabApi.Features.Console; using LabApi.Loader; namespace GamblingCoin; public class Plugin : LabApi.Loader.Features.Plugins.Plugin { public static Plugin Singleton; private GamblingCoinEventHandler _eventHandler; public GamblingCoinChancesConfig ConfigChances; public GamblingCoinGameplayConfig ConfigGameplay; public GamblingCoinMessages ConfigMessages; public override string Name => "GamblingCoin"; public override string Author => "Code002Lover"; public override Version Version { get; } = new(1, 0, 0); public override string Description => "Gamble your life away"; public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion); public override void LoadConfigs() { base.LoadConfigs(); ConfigGameplay = this.LoadConfig("gameplay.yml"); ConfigMessages = this.LoadConfig("messages.yml"); ConfigChances = this.LoadConfig("chances.yml"); } public override void Enable() { Logger.Debug("starting..."); Singleton = this; _eventHandler = new GamblingCoinEventHandler(); PlayerEvents.FlippedCoin += _eventHandler.OnFlippedCoin; } public override void Disable() { Logger.Debug("unloading..."); Singleton = null; PlayerEvents.FlippedCoin -= _eventHandler.OnFlippedCoin; } }