init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
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 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 GamblingCoinGameplayConfig ConfigGameplay;
|
||||
public GamblingCoinMessages ConfigMessages;
|
||||
public GamblingCoinChancesConfig ConfigChances;
|
||||
|
||||
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 static Plugin Singleton;
|
||||
private GamblingCoinEventHandler _eventHandler;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user