package me.proxylink.plugin.bungee;

import me.proxylink.common.AgentConfig;
import me.proxylink.plugin.PluginRuntime;
import net.md_5.bungee.api.plugin.Plugin;

public final class DirtSimpleBungeePlugin extends Plugin {
    private PluginRuntime runtime;

    @Override
    public void onEnable() {
        runtime = new PluginRuntime(getLogger());
        runtime.start(getDataFolder().toPath(), "bungee-default.properties", AgentConfig.Role.FRONTEND);
        getProxy().getPluginManager().registerCommand(this, new DirtSimpleBungeeCommand(runtime));
    }

    @Override
    public void onDisable() {
        if (runtime != null) {
            runtime.stop();
            runtime = null;
        }
    }
}
