Fix party users not being removed correctly (they left the party but still had their party id set)

This commit is contained in:
Teriuihi 2022-05-24 02:49:36 +02:00
parent 3e313cb00b
commit fdd9d81400
2 changed files with 6 additions and 3 deletions

View File

@ -47,7 +47,9 @@ public class Party {
.filter(partyUser -> partyUser.getUuid().equals(uuid))
.findFirst();
if (first.isEmpty()) return;
partyUsers.remove(first.get());
PartyUser partyUser = first.get();
partyUsers.remove(partyUser);
chatUser.setPartyId(-1);
Queries.removePartyUser(uuid);
}

View File

@ -64,13 +64,14 @@ public class Remove implements SubCommand {
return;
}
}
party.removeUser(ChatUserManager.getChatUser(partyUser.getUuid()));
if (partyUser.getUuid().equals(party.getOwnerUuid())) {
source.sendMessage(Utility.parseMiniMessage(Config.CANT_REMOVE_PARTY_OWNER));
return;
}
party.removeUser(ChatUserManager.getChatUser(partyUser.getUuid()));
if (onlinePlayer != null && onlinePlayer.isActive()) {
onlinePlayer.sendMessage(Utility.parseMiniMessage(Config.REMOVED_FROM_PARTY,
Placeholder.unparsed("party", party.getPartyName())