Skip to content

Commit

Permalink
adjust player party api pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Sep 30, 2023
1 parent f9988d7 commit 9188db4
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,4 @@ record ChannelMessage(Component message, ChatChannel channel) {}

CompletableFuture<@Nullable Party> party();

void party(@Nullable Party party);

}
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ public void saved() {
return this.users.party(id);
}

@Override
public void party(final @Nullable Party party) {
this.party.set(party == null ? null : party.id());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,6 @@ public void leaveChannel(final ChatChannel channel) {
return CompletableFuture.completedFuture(null);
}

@Override
public void party(final @Nullable Party party) {

}

@Override
public @NotNull Identity identity() {
return Identity.nil();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void addMember(final UUID id) {
this.userManager.user(id).thenCompose(user -> {
final WrappedCarbonPlayer wrapped = (WrappedCarbonPlayer) user;
final @Nullable UUID oldPartyId = wrapped.partyId();
user.party(this);
wrapped.party(this);
if (oldPartyId != null) {
return this.userManager.party(oldPartyId).thenAccept(old -> {
if (old != null) {
Expand Down Expand Up @@ -112,7 +112,7 @@ public void removeMember(final UUID id) {
this.userManager.user(id).thenAccept(user -> {
final WrappedCarbonPlayer wrapped = (WrappedCarbonPlayer) user;
if (Objects.equals(wrapped.partyId(), this.id)) {
user.party(null);
wrapped.party(null);
}
}).whenComplete(exceptionHandler);
}
Expand All @@ -130,7 +130,7 @@ public void disband() {
if (this.disbanded) {
throw new IllegalStateException("This party is already disbanded.");
}
this.server.players().stream().filter(p -> this.members.contains(p.uuid())).forEach(p -> p.party(null));
this.server.players().stream().filter(p -> this.members.contains(p.uuid())).forEach(p -> ((WrappedCarbonPlayer) p).party(null));
this.userManager.disbandParty(this.id);
this.disbanded = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ public int hashCode() {
return this.carbonPlayerCommon.party();
}

@Override
public void party(final @Nullable Party party) {
this.carbonPlayerCommon.party(party);
}
Expand Down

0 comments on commit 9188db4

Please sign in to comment.