Skip to content

Commit

Permalink
don't allow inviting players already in party
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Sep 30, 2023
1 parent 416be97 commit 89b1065
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ private void invitePlayer(final CommandContext<Commander> ctx) {
this.messages.mustBeInParty(player);
return;
}
final @Nullable Party recipientParty = recipient.party().join();
if (recipientParty != null && recipientParty.id().equals(party.id())) {
this.messages.alreadyInParty(player, recipient.displayName());
return;
}
this.partyInvites.sendInvite(player.uuid(), recipient.uuid(), party.id());
this.messages.receivedPartyInvite(recipient, player.displayName(), party.name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ void errorCommandCommandExecution(
@Message("command.party.cannot_invite_self")
void cannotInviteSelf(Audience audience);

@Message("command.party.already_in_party")
void alreadyInParty(Audience audience, Component displayName);

@Message("command.party.description")
Component partyDesc();

Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/locale/messages-en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ command.party.create.description=Create a new party.
command.party.invite.description=Invite a player to your party.
command.party.accept.description=Accept party invites.
command.party.leave.description=Leave your current party.
command.party.already_in_party=<display_name><red> is already in your party.
command.party.disband.description=Disband your current party.
config.reload.failed=<red>Config failed to reload
config.reload.success=<green>Config reloaded successfully
Expand Down

0 comments on commit 89b1065

Please sign in to comment.