package org.poopki.duckdns.user_db; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import org.poopki.duckdns.user_db.Array.*; import org.poopki.duckdns.user_db.DB.*; import org.poopki.duckdns.user_db.GUI.*; import org.poopki.duckdns.user_db.Invite.*; import java.sql.SQLException; public final class User_DB extends JavaPlugin implements Listener { AccountArray m_AccountArrayInstance = new AccountArray(); UserInfoArray m_InfoArrayInstance = new UserInfoArray(); // UserInfo 저장하는 Array instance 생성 FarmArray m_FarmArrayInstance = new FarmArray(m_InfoArrayInstance); NationArray m_NationArrayInstance = new NationArray(m_InfoArrayInstance); DBUpdate Database_backup = new DBUpdate(m_InfoArrayInstance, m_AccountArrayInstance, m_FarmArrayInstance, m_NationArrayInstance); @Override public void onEnable() { // Plugin startup logic try { Database_backup.InitDB(); Database_backup.LoadDB(); } catch (SQLException e) { throw new RuntimeException(e); } getCommand("계좌").setExecutor(new AccountEventHandler(m_AccountArrayInstance,m_InfoArrayInstance)); getCommand("농장").setExecutor(new FarmEventHandler(m_FarmArrayInstance, m_InfoArrayInstance, m_AccountArrayInstance)); getCommand("국가").setExecutor(new NationEventHandler(m_NationArrayInstance, m_InfoArrayInstance, m_AccountArrayInstance)); getCommand("opitem").setExecutor(new OpenInv(m_AccountArrayInstance, m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance)); getCommand("초대").setExecutor(new InviteMaster(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance)); getServer().getPluginManager().registerEvents(new UserJoin(m_InfoArrayInstance, m_AccountArrayInstance),this); getServer().getPluginManager().registerEvents(new OpenInv(m_AccountArrayInstance, m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance), this); } @Override public void onDisable() { // Plugin shutdown logic try{ Database_backup.UpdateDB(); } catch (SQLException e){ throw new RuntimeException(e); } } }