Fix minor bug

Group_System
poopki 2 years ago
parent 93c37e2d12
commit 012f82b805
  1. 1
      Account.java
  2. 6
      AccountEventHandler.java
  3. 4
      GroupArray.java
  4. 27
      GroupEventHandler.java
  5. 11
      Party.java
  6. 103
      PartyArray.java
  7. 30
      Status.java
  8. 10
      UserInfo.java
  9. 9
      User_DB.java

@ -1,6 +1,5 @@
package org.poopki.duckdns.user_db;
public class Account {
private int m_Balance;
private int MAX_BALANCE = 2147483647;

@ -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 "이체": {

@ -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

@ -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;
}
}

@ -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);
}
}

@ -1,103 +0,0 @@
package org.poopki.duckdns.user_db;
import org.bukkit.Bukkit;
import java.util.*;
public class PartyArray {
private static Map<UUID, Party> m_PartyArray = new HashMap<UUID, Party>();
private static Map<String, UUID> m_PartyNameList = new HashMap<String, UUID>();
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<String> GetPartyMembersName(UUID PartyUUID){
List<String> MembersName = new ArrayList<>();
for (UUID key : m_PartyArray.get(PartyUUID).getGroupMembers()){
MembersName.add(Bukkit.getPlayer(key).getDisplayName());
}
return MembersName;
}
public List<UUID> 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<String> 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);
}
}

@ -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;}

@ -7,15 +7,15 @@ public class UserInfo extends Status {
private String m_Name;
private static Map<String, UUID> m_GroupUUID = new HashMap<String, UUID>();
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); }

@ -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);
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);
}
Loading…
Cancel
Save