2025-06-05 01:12:55 +02:00

45 lines
1.5 KiB
C#

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<GamblingCoinGameplayConfig>("gameplay.yml");
ConfigMessages = this.LoadConfig<GamblingCoinMessages>("messages.yml");
ConfigChances = this.LoadConfig<GamblingCoinChancesConfig>("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;
}
}