package tk.martijn_heil.kingdomessentials.playerclass.hooks;


import org.bukkit.Bukkit;
import tk.martijn_heil.kingdomessentials.command.ModCommand;
import tk.martijn_heil.kingdomessentials.playerclass.ModPlayerClass;
import tk.martijn_heil.kingdomessentials.playerclass.hooks.commands.KingdomKitsGetClassCmd;
import tk.martijn_heil.kingdomessentials.playerclass.hooks.commands.KingdomKitsListCmd;
import tk.martijn_heil.kingdomessentials.playerclass.hooks.commands.KingdomKitsSetClassCmd;
import tk.martijn_heil.kingdomessentials.signs.ExecutableSign;
import tk.martijn_heil.kingdomessentials.signs.ModSigns;
import tk.martijn_heil.nincore.api.command.NinCommand;
import tk.martijn_heil.nincore.api.command.builders.SubCommandBuilder;
import tk.martijn_heil.nincore.api.localization.LocalizedString;
import tk.martijn_heil.nincore.api.logging.LogColor;

import java.util.logging.Logger;

public class ModCommandHook
{
    public ModCommandHook(Logger logger)
    {
        if(Bukkit.getPluginManager().isPluginEnabled("KE-ModCommand"))
        {
            logger.info("ModCommand detected, hooking in..");
            new Hook(logger);
        }
    }

    private class Hook
    {
        public Hook(Logger logger)
        {
            ModPlayerClass.getInstance().getNinLogger().info("Registering executable signs..");
            ModSigns.getInstance().getRegister().addExecutableSign(new ExecutableSign("SetClass", new SetClassSignExecutor()));

            NinCommand kk = ModCommand.getMainCommand();

            logger.info("Creating sub commands..");

            logger.fine("Creating" + LogColor.HIGHLIGHT + "/kingdomessentials getclass" + LogColor.RESET + " sub command.");
            new SubCommandBuilder()
                    .setName("getclass")
                    .setUsage("<player=you>")
                    .setRequiredPermission("kingdomess.playerclass.getclass")
                    .setUseStaticDescription(false)
                    .setLocalizedDescription(new LocalizedString(this.getClass().getClassLoader(), "tk.martijn_heil.kingdomessentials.playerclass.res.messages", "command.getclass.description"))
                    .setParentCommand(kk)
                    .setExecutor(new KingdomKitsGetClassCmd())
                    .construct();

            logger.fine("Creating" + LogColor.HIGHLIGHT + "/kingdomessentials list" + LogColor.RESET + " sub command.");
            new SubCommandBuilder()
                    .setName("list")
                    .setRequiredPermission("kingdomess.playerclass.list")
                    .setUseStaticDescription(false)
                    .setLocalizedDescription(new LocalizedString(this.getClass().getClassLoader(), "tk.martijn_heil.kingdomessentials.playerclass.res.messages", "command.list.description"))
                    .setParentCommand(kk)
                    .setExecutor(new KingdomKitsListCmd())
                    .construct();

            logger.fine("Creating" + LogColor.HIGHLIGHT + "/kingdomessentials setclass" + LogColor.RESET + " sub command.");
            new SubCommandBuilder()
                    .setName("setclass")
                    .setUsage("<class> <player=you>")
                    .setRequiredPermission("kingdomess.playerclass.setclass")
                    .setUseStaticDescription(false)
                    .setLocalizedDescription(new LocalizedString(this.getClass().getClassLoader(), "tk.martijn_heil.kingdomessentials.playerclass.res.messages", "command.setclass.description"))
                    .setParentCommand(kk)
                    .setExecutor(new KingdomKitsSetClassCmd())
                    .construct();
        }
    }
}

@@ -147,77 +147,8 @@
 nd;%0A
-import tk.martijn_heil.kingdomessentials.playerclass.ModPlayerClass;%0A
 impo
@@ -227,32 +227,32 @@
 itsGetClassCmd;%0A
+
 import tk.martij
@@ -419,128 +419,8 @@
 md;%0A
-import tk.martijn_heil.kingdomessentials.signs.ExecutableSign;%0Aimport tk.martijn_heil.kingdomessentials.signs.ModSigns;%0A
 impo
@@ -1021,24 +1021,24 @@
 ger logger)%0A
+
         %7B%0A  
@@ -1039,233 +1039,8 @@
   %7B%0A
-            ModPlayerClass.getInstance().getNinLogger().info(%22Registering executable signs..%22);%0A            ModSigns.getInstance().getRegister().addExecutableSign(new ExecutableSign(%22SetClass%22, new SetClassSignExecutor()));%0A%0A
     

Fix SetClass executable sign being registered twie