package com.yuyu.srdisassemble;

import com.sakurarealm.sritem.bukkit.command.CommandBase;
import com.yuyu.srdisassemble.command.DisCommand;
import com.yuyu.srdisassemble.command.MeltCommand;
import com.yuyu.srdisassemble.command.RepairCommand;
import com.yuyu.srdisassemble.config.ConfigManager;
import com.yuyu.srdisassemble.data.JdbcSqlClass;
import com.yuyu.srdisassemble.disassemeble.TemporarilyBox;
import lombok.Getter;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;

public final class SrDisassemble extends JavaPlugin {


    @Getter
    private static ConfigManager configManager;//用于鉴定


    @Override
    public void onEnable() {
        // Plugin startup logic
        getLogger().info(ChatColor.GOLD+"分解插件开始运行!");
        this.configManager = new ConfigManager(this);

        //注册指令
        CommandBase commandBase = new CommandBase();
        this.getCommand("srdisassemble").setExecutor(commandBase);
        commandBase.registerSubCommand("open",new DisCommand());
        commandBase.registerSubCommand("reload",new DisCommand());


        //读取暂存箱
        JdbcSqlClass.createPauseBoxTable();
//        JdbcSqlClass.setPauseBox2UTF();
        TemporarilyBox.getPauseBoxData();


    }

    @Override
    public void onDisable() {
        JdbcSqlClass.clearPauseBoxTable();
        // Plugin shutdown logic
        TemporarilyBox.savePauseBoxData();
    }
}
