Maybe fixed party

This commit is contained in:
Teriuihi 2022-02-14 01:25:51 +01:00
parent 777415f97e
commit 2b77607072
2 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,5 @@
package com.alttd.chat.database;
import com.alttd.chat.managers.ChatUserManager;
import com.alttd.chat.managers.PartyManager;
import com.alttd.chat.objects.ChatUser;
import com.alttd.chat.objects.Mail;
@ -10,8 +9,10 @@ import com.alttd.chat.objects.channels.Channel;
import com.alttd.chat.util.ALogger;
import java.sql.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
public class Queries {
@ -185,6 +186,7 @@ public class Queries {
ALogger.warn("Unable to retrieve party: " + id);
continue;
}
System.out.println("ADDING PARTY USER " + party.getPartyName() + " " + playerName);
party.putPartyUser(new PartyUser(uuid, displayName, playerName));
}

View File

@ -14,7 +14,7 @@ public class Party {
private UUID ownerUuid;
private String partyName;
private String partyPassword;
private static ArrayList<PartyUser> partyUsers;
private final ArrayList<PartyUser> partyUsers;
public Party(int partyId, UUID ownerUuid, String partyName, String partyPassword) {
this.partyId = partyId;
@ -29,6 +29,9 @@ public class Party {
}
public void addUser(ChatUser chatUser, String playerName) {
Party party = PartyManager.getParty(chatUser.getPartyId());
if (party != null)
party.removeUser(chatUser);
partyUsers.add(new PartyUser(chatUser.getUuid(), chatUser.getDisplayName(), playerName));
chatUser.setPartyId(getPartyId());
Queries.addPartyUser(chatUser);