You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
5.1 KiB
92 lines
5.1 KiB
package org.poopki.duckdns.user_db; |
|
|
|
import com.sk89q.worldguard.WorldGuard; |
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; |
|
import com.sk89q.worldguard.protection.managers.RegionManager; |
|
import com.sk89q.worldguard.protection.regions.RegionContainer; |
|
import org.bukkit.Bukkit; |
|
import org.bukkit.entity.Player; |
|
import org.bukkit.event.Listener; |
|
import org.bukkit.plugin.Plugin; |
|
import org.bukkit.plugin.java.JavaPlugin; |
|
import org.poopki.duckdns.user_db.Array.*; |
|
import org.poopki.duckdns.user_db.Bank.AccountGUIEvent; |
|
import org.poopki.duckdns.user_db.DB.*; |
|
import org.poopki.duckdns.user_db.GUI.*; |
|
import org.poopki.duckdns.user_db.InfoGUI.ScoreboardEvent; |
|
import org.poopki.duckdns.user_db.Invite.*; |
|
import org.poopki.duckdns.user_db.TechTree.TechGUIEvent; |
|
import org.poopki.duckdns.user_db.Research.*; |
|
import org.poopki.duckdns.user_db.WorldGuard.*; |
|
|
|
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, 10,this); |
|
NationArray m_NationArrayInstance = new NationArray(m_InfoArrayInstance,50,this); |
|
SquadArray m_SquadArrayInstance = new SquadArray(m_InfoArrayInstance,4,this); |
|
ScoreboardEvent m_ScoreboardEventHandler = new ScoreboardEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance); |
|
DBUpdate Database_backup = new DBUpdate(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance); |
|
final WgCommand wgCommand = new WgCommand(); |
|
@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_InfoArrayInstance, m_AccountArrayInstance)); |
|
getCommand("농장").setExecutor(new FarmEventHandler(m_InfoArrayInstance, m_FarmArrayInstance, m_AccountArrayInstance)); |
|
getCommand("국가").setExecutor(new NationEventHandler(m_InfoArrayInstance, m_NationArrayInstance, m_AccountArrayInstance)); |
|
getCommand("분대").setExecutor(new SquadEventHandler(m_InfoArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance)); |
|
getCommand("opitem").setExecutor(new OpenInv(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance)); |
|
getCommand("은행").setExecutor(new AccountGUIEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance)); |
|
getCommand("테크").setExecutor(new TechGUIEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance)); |
|
getCommand("초대").setExecutor(new InviteMaster(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance)); |
|
getCommand("연구").setExecutor(new ResearchGUIEvent(m_InfoArrayInstance, m_NationArrayInstance)); |
|
getCommand("wge").setExecutor(wgCommand); |
|
getCommand("wge").setTabCompleter(wgCommand); |
|
|
|
getServer().getPluginManager().registerEvents(new UserJoin(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance, m_ScoreboardEventHandler), |
|
this); |
|
getServer().getPluginManager().registerEvents(new OpenInv( m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance), this); |
|
getServer().getPluginManager().registerEvents(new AccountGUIEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance), this); |
|
getServer().getPluginManager().registerEvents(new TechGUIEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance), this); |
|
//getServer().getPluginManager().registerEvents(new WgCommand(), this); |
|
getServer().getPluginManager().registerEvents(new WGRegionExample(), this); |
|
getCommand("지역").setExecutor(new WG(this)); |
|
|
|
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { |
|
@Override |
|
public void run(){ |
|
for(Player p : Bukkit.getOnlinePlayers()) { |
|
m_ScoreboardEventHandler.ScoreboardUpdate(p); |
|
} |
|
try{ |
|
Database_backup.UpdateDB(); |
|
} catch (SQLException e){ |
|
throw new RuntimeException(e); |
|
} |
|
} |
|
},0,20L); |
|
|
|
} |
|
@Override |
|
public void onDisable() { |
|
// Plugin shutdown logic |
|
try{ |
|
Database_backup.UpdateDB(); |
|
} catch (SQLException e){ |
|
throw new RuntimeException(e); |
|
} |
|
} |
|
|
|
|
|
}
|
|
|