Skip to content

Commit

Permalink
Fix Parties getParty with player UUID (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioDP authored Aug 26, 2023
1 parent 9a0c438 commit 75c6291
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ public List<Player> getMembers(Player p) {
public void createParty(Player owner, Player... members) {
//party creation handled on bungee side
if (!api.isBungeeCordEnabled()) {
boolean created = api.createParty(null, api.getPartyPlayer(owner.getUniqueId()));
if (created) {
com.alessiodp.parties.api.interfaces.Party party = api.getParty(owner.getUniqueId());
if (null != party) {
for (Player player1 : members) {
PartyPlayer partyPlayer = api.getPartyPlayer(player1.getUniqueId());
if (null != partyPlayer) {
party.addMember(partyPlayer);
PartyPlayer partyOwner = api.getPartyPlayer(owner.getUniqueId());
if (null != partyOwner && !partyOwner.isInParty()) {
boolean created = api.createParty(null, partyOwner);
if (created && null != partyOwner.getPartyId()) {
com.alessiodp.parties.api.interfaces.Party party = api.getParty(partyOwner.getPartyId());
if (null != party) {
for (Player player1 : members) {
PartyPlayer partyPlayer = api.getPartyPlayer(player1.getUniqueId());
if (null != partyPlayer && !partyPlayer.isInParty()) {
party.addMember(partyPlayer);
}
}
}
}
Expand Down Expand Up @@ -178,7 +181,8 @@ public void removePlayer(Player owner, Player target) {

@Override
public Player getOwner(Player member) {
return Bukkit.getPlayer(Objects.requireNonNull(api.getParty(member.getUniqueId())).getLeader());
PartyPlayer partyPlayer = api.getPartyPlayer(member.getUniqueId());
return Bukkit.getPlayer(Objects.requireNonNull(api.getParty(Objects.requireNonNull(partyPlayer).getPartyId())).getLeader());
}

@Override
Expand Down

0 comments on commit 75c6291

Please sign in to comment.