diff --git a/common/src/main/java/net/draycia/carbon/common/command/commands/PartyCommands.java b/common/src/main/java/net/draycia/carbon/common/command/commands/PartyCommands.java index f90ecb09c..61b7a89ff 100644 --- a/common/src/main/java/net/draycia/carbon/common/command/commands/PartyCommands.java +++ b/common/src/main/java/net/draycia/carbon/common/command/commands/PartyCommands.java @@ -163,6 +163,10 @@ private void createParty(final CommandContext ctx) { private void invitePlayer(final CommandContext ctx) { final CarbonPlayer player = ((PlayerCommander) ctx.getSender()).carbonPlayer(); final CarbonPlayer recipient = ctx.get("player"); + if (recipient.uuid().equals(player.uuid())) { + this.messages.cannotInviteSelf(player); + return; + } final @Nullable Party party = player.party().join(); if (party == null) { this.messages.mustBeInParty(player); diff --git a/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessages.java b/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessages.java index f7740cd03..4ed324ca5 100644 --- a/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessages.java +++ b/common/src/main/java/net/draycia/carbon/common/messages/CarbonMessages.java @@ -466,6 +466,9 @@ void errorCommandCommandExecution( @Message("command.party.must_be_in_party") void mustBeInParty(Audience audience); + @Message("command.party.cannot_invite_self") + void cannotInviteSelf(Audience audience); + @Message("command.party.description") Component partyDesc(); diff --git a/common/src/main/resources/locale/messages-en_US.properties b/common/src/main/resources/locale/messages-en_US.properties index a72f13430..05a96a940 100644 --- a/common/src/main/resources/locale/messages-en_US.properties +++ b/common/src/main/resources/locale/messages-en_US.properties @@ -74,6 +74,7 @@ command.party.left_party=Successfully left party 'Successfully disbanded party ''. command.party.cannot_disband_multiple_members=Cannot disband party '', you are not the last member. command.party.must_be_in_party=You must be in a party to use this command. +command.party.cannot_invite_self=You cannot invite yourself. command.party.description=Get info about your current party. command.party.create.description=Create a new party. command.party.invite.description=Invite a player to your party.