diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java index a82c51458..3be2b951b 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java @@ -40,13 +40,12 @@ public class PartyInviteCommand implements CommandExecutor { return true; } - Party playerParty = mcMMOPlayer.getParty(); - - if (!PartyManager.canInvite(playerName, playerParty)) { + if (!PartyManager.canInvite(mcMMOPlayer)) { player.sendMessage(LocaleLoader.getString("Party.Locked")); return true; } + Party playerParty = mcMMOPlayer.getParty(); mcMMOTarget.setPartyInvite(playerParty); sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success")); diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index aa0829e18..47e5bbf2b 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -378,8 +378,10 @@ public final class PartyManager { * @param party The party to check * @return true if the player can invite */ - public static boolean canInvite(String playerName, Party party) { - return !party.isLocked() || party.getLeader().equalsIgnoreCase(playerName); + public static boolean canInvite(McMMOPlayer mcMMOPlayer) { + Party party = mcMMOPlayer.getParty(); + + return !party.isLocked() || party.getLeader().equalsIgnoreCase(mcMMOPlayer.getPlayer().getName()); } /**