diff --git a/Account.java b/Account.java index 50707ae..8e929e7 100644 --- a/Account.java +++ b/Account.java @@ -1,6 +1,5 @@ package org.poopki.duckdns.user_db; - public class Account { private int m_Balance; private int MAX_BALANCE = 2147483647; diff --git a/AccountEventHandler.java b/AccountEventHandler.java index 5eb75ea..4f926b4 100644 --- a/AccountEventHandler.java +++ b/AccountEventHandler.java @@ -34,7 +34,7 @@ public class AccountEventHandler implements CommandExecutor { if (args.length > 2) { if (isStringDouble(args[2])) { if(m_AccountArray.setAccountInfo(op.getUniqueId(), Long.parseLong(args[2]))){ - p.sendMessage(op.getName() + "님의 잔액을" + Integer.parseInt(args[2]) + "원으로 설정하였습니다."); + p.sendMessage(op.getName() + "님의 잔액을 " + Integer.parseInt(args[2]) + "원으로 설정하였습니다."); } else{ p.sendMessage("최대 금액 이상으로 설정할 수 없습니다."); } @@ -58,7 +58,11 @@ public class AccountEventHandler implements CommandExecutor { break; } case "잔액": { - p.sendMessage("잔액: " + m_AccountArray.getAccountInfo(p.getUniqueId()) + "원"); + p.sendMessage("==잔액: " + m_AccountArray.getAccountInfo(p.getUniqueId()) + "원=="); + break; + } + case "테스트": { + p.sendMessage("ㅅㅅㅅㅅㅅㅅ"); break; } case "이체": { diff --git a/GroupArray.java b/GroupArray.java index 0afc805..71c3728 100644 --- a/GroupArray.java +++ b/GroupArray.java @@ -27,7 +27,7 @@ public class GroupArray { public boolean DeleteGroup(UUID GroupUUID, String GroupType){ if(m_GroupArray.containsKey(GroupUUID)){ for(UUID key: GetGroupMembersUUID(GroupUUID)){ - m_UserInfoArray.setUserPartyUUID(GroupType,key,new UUID(0,0)); + m_UserInfoArray.setUserGroupUUID(GroupType,key,new UUID(0,0)); } m_GroupNameList.remove(GetGroupName(GroupUUID)); @@ -45,7 +45,7 @@ public class GroupArray { if(isOffline(PlayerUUID)){ Group m_Group = m_GroupArray.get(GroupUUID); m_Group.SignUp(PlayerUUID); - m_UserInfoArray.setUserPartyUUID(GroupType,PlayerUUID,GroupUUID); + m_UserInfoArray.setUserGroupUUID(GroupType,PlayerUUID,GroupUUID); return 1; // Success }else{ return 2; // Offline Player diff --git a/PartyEventHandler.java b/GroupEventHandler.java similarity index 62% rename from PartyEventHandler.java rename to GroupEventHandler.java index 6f92c70..5ac630c 100644 --- a/PartyEventHandler.java +++ b/GroupEventHandler.java @@ -7,13 +7,13 @@ import org.bukkit.entity.Player; import java.util.UUID; -public class PartyEventHandler implements CommandExecutor { +public class GroupEventHandler implements CommandExecutor { - PartyArray m_PartyArray; + GroupArray m_GroupArray; UserInfoArray m_UserInfoArray; - public PartyEventHandler(PartyArray PA, UserInfoArray UIA){ - m_PartyArray = PA; + public GroupEventHandler(GroupArray GA, UserInfoArray UIA){ + m_GroupArray = GA; m_UserInfoArray = UIA; } @Override @@ -24,32 +24,33 @@ public class PartyEventHandler implements CommandExecutor { switch (args[0]) { case "생성":{ UUID tempUUID = UUID.randomUUID(); - m_PartyArray.CreateParty(tempUUID, args[1], p.getUniqueId()); - m_UserInfoArray.setUserPartyUUID("Party",p.getUniqueId(), tempUUID); + m_GroupArray.CreateGroup(tempUUID, args[1], p.getUniqueId()); + m_UserInfoArray.setUserGroupUUID("Party",p.getUniqueId(), tempUUID); p.sendMessage(args[1]+"파티가 생성되었습니다."); p.sendMessage("멤버 목록: "); - for (String Name: m_PartyArray.GetPartyMembersName(tempUUID)){ + for (String Name: m_GroupArray.GetGroupMembersName(tempUUID)){ p.sendMessage(Name); } p.sendMessage("파티 목록:"); - for (String Name: m_PartyArray.GetPartyNameList()){ + for (String Name: m_GroupArray.GetGroupNameList()){ p.sendMessage(Name); } break; } - /* case "가입":{ - + case "가입":{ + p.sendMessage("가입 테스트"); break; } case "초대":{ + p.sendMessage("초대 테스트"); break; } case "강퇴":{ - + p.sendMessage("강퇴 테스트"); break; } -*/ case "이름":{ - p.sendMessage("현재 파티 이름"+m_PartyArray.GetPartyName(m_UserInfoArray.getUserPartyUUID(p.getUniqueId(),"Party"))); + case "이름":{ + p.sendMessage("현재 파티 이름"+m_GroupArray.GetGroupName(m_UserInfoArray.getUserGroupUUID(p.getUniqueId(),"Party"))); break; } } diff --git a/Party.java b/Party.java deleted file mode 100644 index 81f8a6c..0000000 --- a/Party.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.poopki.duckdns.user_db; - -import java.util.UUID; - -public class Party extends Group{ - - public Party(String Name, UUID uuid) { - super(Name, uuid); - } - -} diff --git a/PartyArray.java b/PartyArray.java deleted file mode 100644 index 3fb9b98..0000000 --- a/PartyArray.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.poopki.duckdns.user_db; - -import org.bukkit.Bukkit; - -import java.util.*; - -public class PartyArray { - private static Map m_PartyArray = new HashMap(); - - private static Map m_PartyNameList = new HashMap(); - - UserInfoArray m_UserInfoArray; - - public PartyArray(UserInfoArray m_UIA){ - m_UserInfoArray = m_UIA; - } - public boolean CreateParty(UUID PartyUUID, String Name, UUID PlayerUUID){ - if(m_PartyNameList.containsKey(Name)){ - return false; // Conflict - } else{ - m_PartyArray.put(PartyUUID, new Party(Name, PlayerUUID)); - m_PartyNameList.put(Name, PartyUUID); - return true; - } - } - - public boolean DeleteParty(UUID PartyUUID){ - if(m_PartyArray.containsKey(PartyUUID)){ - for(UUID key: GetPartyMembersUUID(PartyUUID)){ - m_UserInfoArray.setUserPartyUUID("Party",key, new UUID(0,0)); - } - - m_PartyNameList.remove(GetPartyName(PartyUUID)); - m_PartyArray.remove(PartyUUID); - return true; - } - else{ - return false; // Party is not exists. - } - - } - - public Integer SignUpParty(UUID PartyUUID, UUID PlayerUUID){ - if(m_PartyArray.containsKey(PartyUUID)){ - if(isOffline(PlayerUUID)){ - Party m_Party = m_PartyArray.get(PartyUUID); - m_Party.SignUp(PlayerUUID); - m_UserInfoArray.setUserPartyUUID("Party",PlayerUUID,PartyUUID); - return 1; // Success - }else{ - return 2; // Offline Player - } - } else{ - return 3; // Wrong Party - } - } - - public boolean ExpulsionPartyPlayer(UUID PartyUUID, UUID PlayerUUID){ - if(GetPartyMembersName(PartyUUID).contains(PlayerUUID)) { - Party m_Party = m_PartyArray.get(PartyUUID); - m_Party.Expulsion(PlayerUUID); - return true; - } else{ - return false; // Wrong Player Name. FIXME{Need Checking function for a validate user name's } - /* Player op = Bukkit.getPlayer(args[1]); - if (op != null) { - */ - } - } - - public List GetPartyMembersName(UUID PartyUUID){ - List MembersName = new ArrayList<>(); - for (UUID key : m_PartyArray.get(PartyUUID).getGroupMembers()){ - MembersName.add(Bukkit.getPlayer(key).getDisplayName()); - } - return MembersName; - } - public List GetPartyMembersUUID(UUID PartyUUID){ - return m_PartyArray.get(PartyUUID).getGroupMembers(); - } - public boolean isPartyMember(UUID PartyUUID, UUID PlayerUUID){ - Party m_Party = m_PartyArray.get(PartyUUID); - return m_Party.isMember(PlayerUUID); - } - - public Set GetPartyNameList(){ - return m_PartyNameList.keySet(); - } - - - public String GetPartyName(UUID PartyUUID){ - Party m_Party = m_PartyArray.get(PartyUUID); - return m_Party.getGroupName(); - } - public static boolean isOffline(UUID uuid){ - return Bukkit.getPlayer(uuid).equals(null) && !Bukkit.getOfflinePlayer(uuid).equals(null); - } - - private boolean isAvaliableParty(UUID PartyUUID){ - return m_PartyArray.containsKey(PartyUUID); - } - -} diff --git a/Status.java b/Status.java index b719bb1..0b861ba 100644 --- a/Status.java +++ b/Status.java @@ -52,15 +52,15 @@ public class Status { public int GetMaxEXP(){return m_MAX_EXP;} public int GetLevel(){return m_Level;} - public int SetBaseHP(HP){m_BASE_HP=HP;} - public int SetBaseMP(MP){m_BASE_MP=MP;} - public int SetBaseSTR(STR){m_BASE_STR=STR;} - public int SetBaseDEX(DEX){m_BASE_DEX=DEX;} - public int SetBaseINT(INT){m_BASE_INT=INT;} - public int SetBaseLUK(LUK){m_BASE_LUK=LUK;} - public int SetEXP(EXP){m_EXP=EXP;} - public int SetMaxEXP(EXP){m_MAX_EXP=EXP;} - public int SetLevel(Level){m_Level=Level;} + public int SetBaseHP(int HP){return m_BASE_HP=HP;} + public int SetBaseMP(int MP){return m_BASE_MP=MP;} + public int SetBaseSTR(int STR){return m_BASE_STR=STR;} + public int SetBaseDEX(int DEX){return m_BASE_DEX=DEX;} + public int SetBaseINT(int INT){return m_BASE_INT=INT;} + public int SetBaseLUK(int LUK){return m_BASE_LUK=LUK;} + public int SetEXP(int EXP){return m_EXP=EXP;} + public int SetMaxEXP(int EXP){return m_MAX_EXP=EXP;} + public int SetLevel(int Level){return m_Level=Level;} public int GetBasePATK(){return m_BASE_PATK;} public int GetBasePDEF(){return m_BASE_PDEF;} @@ -74,12 +74,12 @@ public class Status { public int GetEqINT(){return m_EQ_INT;} public int GetEqLUK(){return m_EQ_LUK;} - public int SetEqHP(HP){m_EQ_HP=HP;} - public int SetEqMP(MP){m_EQ_MP=MP;} - public int SetEqSTR(STR){m_EQ_STR=STR;} - public int SetEqDEX(DEX){m_EQ_DEX=DEX;} - public int SetEqINT(INT){m_EQ_INT=INT;} - public int SetEqLUK(LUK){m_EQ_LUK=LUK;} + public int SetEqHP(int HP){return m_EQ_HP=HP;} + public int SetEqMP(int MP){return m_EQ_MP=MP;} + public int SetEqSTR(int STR){return m_EQ_STR=STR;} + public int SetEqDEX(int DEX){return m_EQ_DEX=DEX;} + public int SetEqINT(int INT){return m_EQ_INT=INT;} + public int SetEqLUK(int LUK){return m_EQ_LUK=LUK;} public int GetEqPATK(){return m_EQ_PATK;} public int GetEqPDEF(){return m_EQ_PDEF;} diff --git a/UserInfo.java b/UserInfo.java index cafdcf3..338ac51 100644 --- a/UserInfo.java +++ b/UserInfo.java @@ -7,15 +7,15 @@ public class UserInfo extends Status { private String m_Name; private static Map m_GroupUUID = new HashMap(); - public UserInfo(UUID uuid, String Name){ //UserInfo 초기화 + public UserInfo(UUID uuid, String Name, UUID Nation, UUID Squad, UUID Farm, UUID Party){ //UserInfo 초기화 super(100,100,1,10,10,10,10); //HP, MP, LEV, STR, DEX, INT, LUK m_UUID = uuid; m_Name = Name; - m_GroupUUID.put("Nation", 0); - m_GroupUUID.put("Squad", 0); - m_GroupUUID.put("Farm", 0); - m_GroupUUID.put("Party", 0); + m_GroupUUID.put("Nation", Nation); + m_GroupUUID.put("Squad", Squad); + m_GroupUUID.put("Farm", Farm); + m_GroupUUID.put("Party", Party); } public void SetGroupUUID(String GroupType, UUID m_UUID){ m_GroupUUID.put(GroupType, m_UUID); } diff --git a/The_Seed.java b/User_DB.java similarity index 76% rename from The_Seed.java rename to User_DB.java index 3258f7f..871eedc 100644 --- a/The_Seed.java +++ b/User_DB.java @@ -3,16 +3,15 @@ package org.poopki.duckdns.user_db; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import org.poopki.duckdns.user_db.DB.*; -import java.sql.Connection; + import java.sql.SQLException; -import java.sql.Statement; -public final class The_Seed extends JavaPlugin implements Listener { +public final class User_DB extends JavaPlugin implements Listener { AccountArray m_AccountArrayInstance = new AccountArray(); - UserInfoArray m_InfoArrayInstance = new UserInfoArray(); // UserInfo저장하는 Array instance 생성 - PartyArray m_PartyArrayInstance = new PartyArray(m_InfoArrayInstance); + UserInfoArray m_InfoArrayInstance = new UserInfoArray(); // UserInfo 저장하는 Array instance 생성 + GroupArray m_GroupArrayInstance = new GroupArray(m_InfoArrayInstance); DBUpdate Database_backup = new DBUpdate(m_InfoArrayInstance, m_AccountArrayInstance); @Override @@ -25,7 +24,7 @@ public final class The_Seed extends JavaPlugin implements Listener { throw new RuntimeException(e); } getCommand("계좌").setExecutor(new AccountEventHandler(m_AccountArrayInstance)); - getCommand("파티").setExecutor(new PartyEventHandler(m_PartyArrayInstance, m_InfoArrayInstance)); + getCommand("그룹").setExecutor(new GroupEventHandler(m_GroupArrayInstance, m_InfoArrayInstance)); getServer().getPluginManager().registerEvents(new UserJoin(m_InfoArrayInstance, m_AccountArrayInstance),this); }