package org.poopki.duckdns.user_db; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; import org.poopki.duckdns.user_db.Array.*; import org.poopki.duckdns.user_db.InfoGUI.ScoreboardEvent; import java.util.UUID; public class UserJoin implements Listener { private UserInfoArray m_InfoArrayInstance; private AccountArray m_AccountArray; private FarmArray m_FarmArray; private NationArray m_NationArray; private SquadArray m_SquadArray; UUID ZERO_UUID = new UUID(0,0); private ScoreboardEvent m_ScoreboardEventHandler; UserJoin(UserInfoArray m_UIA, FarmArray FA, NationArray NA, SquadArray SA, AccountArray AA, ScoreboardEvent SE){ m_AccountArray = AA; m_InfoArrayInstance = m_UIA; m_FarmArray = FA; m_NationArray = NA; m_SquadArray = SA; m_ScoreboardEventHandler = SE; } @EventHandler public void PlayerLogin(PlayerJoinEvent e) { Player p = e.getPlayer(); if(!m_InfoArrayInstance.checkNewUser(p.getUniqueId())){ //새로운 user인 경우 array에 등록 m_InfoArrayInstance.putUserInfo(p.getUniqueId(), p.getName(), new UUID(0,0), new UUID(0,0), new UUID(0,0), new UUID(0,0)); m_AccountArray.putAccountInfo(p.getUniqueId(), 0); } m_ScoreboardEventHandler.ScoreboardUpdate(p); if(!m_InfoArrayInstance.getUserGroupUUID(p.getUniqueId(),"Nation").equals(ZERO_UUID)){ m_NationArray.m_NationArray.get(m_InfoArrayInstance.getUserGroupUUID(p.getUniqueId(),"Nation")).AddShowResearchProgressBar(0, p); m_NationArray.m_NationArray.get(m_InfoArrayInstance.getUserGroupUUID(p.getUniqueId(),"Nation")).AddShowResearchProgressBar(1, p); m_NationArray.m_NationArray.get(m_InfoArrayInstance.getUserGroupUUID(p.getUniqueId(),"Nation")).AddShowResearchProgressBar(2, p); } } }