package de.teleportsuite.bungee;

import de.teleportsuite.bungee.listener.PlayerConnectionListener;
import de.teleportsuite.bungee.manager.TeleportMessageListener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.api.plugin.PluginManager;

public class TeleportSuiteBungee extends Plugin {

    public static final String CHANNEL_TO_BUNGEE = "teleportsuite:tobungee";
    public static final String CHANNEL_TO_SPIGOT  = "teleportsuite:tospigot";

    private static TeleportSuiteBungee instance;

    @Override
    public void onEnable() {
        instance = this;
        PluginManager pm = getProxy().getPluginManager();

        getProxy().registerChannel(CHANNEL_TO_BUNGEE);
        getProxy().registerChannel(CHANNEL_TO_SPIGOT);

        pm.registerListener(this, new TeleportMessageListener(this));
        pm.registerListener(this, new PlayerConnectionListener(this));

        getLogger().info("TeleportSuite-Bungee aktiviert.");
    }

    @Override
    public void onDisable() {
        getProxy().getScheduler().cancel(this);
        getLogger().info("TeleportSuite-Bungee deaktiviert.");
    }

    public static TeleportSuiteBungee getInstance() {
        return instance;
    }
}
