To Do: PartyArray를 GroupArray로 변경 후 상속하여 사용하게끔 변경 필요.

Group_System
poopki 3 years ago
parent 71a5aa8e8c
commit 6bbf4c8713
  1. 77
      PartyArray.java
  2. 2
      PartyEventHandler.java
  3. 3
      User_DB.java

@ -8,28 +8,76 @@ 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>();
public void CreateParty(UUID PartyUUID, String Name, UUID PlayerUUID){
m_PartyArray.put(PartyUUID, new Party(Name, PlayerUUID));
m_PartyNameList.put(Name, PartyUUID);
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 void SignUpParty(UUID PartyUUID, UUID PlayerUUID){
Party m_Party = m_PartyArray.get(PartyUUID);
m_Party.SignUp(PlayerUUID);
public boolean DeleteParty(UUID PartyUUID){
if(m_PartyArray.containsKey(PartyUUID)){
for(UUID key: GetPartyMembersUUID(PartyUUID)){
m_UserInfoArray.setUserPartyUUID(key, new UUID(0,0));
}
m_PartyNameList.remove(GetPartyName(PartyUUID));
m_PartyArray.remove(PartyUUID);
return true;
}
else{
return false; // Party is not exists.
}
}
public void ExpulsionParty(UUID PartyUUID, UUID PlayerUUID){
Party m_Party = m_PartyArray.get(PartyUUID);
m_Party.Expulsion(PlayerUUID);
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(PlayerUUID,PartyUUID);
return 1; // Success
}else{
return 2; // Offline Player
}
} else{
return 3; // Wrong Party
}
}
public List<String> GetPartyMembers(UUID PartyUUID){
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);
@ -39,8 +87,17 @@ public class PartyArray {
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);
}
}

@ -28,7 +28,7 @@ public class PartyEventHandler implements CommandExecutor {
m_UserInfoArray.setUserPartyUUID(p.getUniqueId(), tempUUID);
p.sendMessage(args[1]+"파티가 생성되었습니다.");
p.sendMessage("멤버 목록: ");
for (String Name: m_PartyArray.GetPartyMembers(tempUUID)){
for (String Name: m_PartyArray.GetPartyMembersName(tempUUID)){
p.sendMessage(Name);
}
p.sendMessage("파티 목록:");

@ -11,9 +11,8 @@ import java.sql.Statement;
public final class User_DB extends JavaPlugin implements Listener {
AccountArray m_AccountArrayInstance = new AccountArray();
PartyArray m_PartyArrayInstance = new PartyArray();
UserInfoArray m_InfoArrayInstance = new UserInfoArray(); // UserInfo저장하는 Array instance 생성
PartyArray m_PartyArrayInstance = new PartyArray(m_InfoArrayInstance);
DBUpdate Database_backup = new DBUpdate(m_InfoArrayInstance, m_AccountArrayInstance);
@Override

Loading…
Cancel
Save