From ccedd233422fe16e19fcad10adb928480d9bb253 Mon Sep 17 00:00:00 2001 From: bm01 Date: Sat, 9 Feb 2013 16:21:13 +0100 Subject: [PATCH] Fixed NPE on /party join when the sender isn't in a party Also cleaned up PartyManager.joinParty since it's no longer supposed to create any party. --- .../com/gmail/nossr50/party/PartyManager.java | 22 +++---------------- .../party/commands/PartyJoinCommand.java | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index 44231f651..5c3ac99d3 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -287,27 +287,11 @@ public final class PartyManager { * * @param player The player to add to the party * @param mcMMOPlayer The player to add to the party - * @param partyName The party to add the player to + * @param party The party to add the player to * @param password the password for this party, null if there was no password */ - public static void joinParty(Player player, McMMOPlayer mcMMOPlayer, String partyName, String password) { - partyName = partyName.replace(".", ""); - Party party = getParty(partyName); - - if (party == null) { - party = new Party(); - - party.setName(partyName); - party.setLeader(player.getName()); - - if (password != null) { - party.setPassword(password); - party.setLocked(true); - } - - parties.add(party); - } - else if (!checkPartyPassword(player, party, password)) { + public static void joinParty(Player player, McMMOPlayer mcMMOPlayer, Party party, String password) { + if (!checkPartyPassword(player, party, password)) { return; } diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyJoinCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyJoinCommand.java index 7fc4f7acf..64dbb0f2a 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyJoinCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyJoinCommand.java @@ -49,7 +49,7 @@ public class PartyJoinCommand implements CommandExecutor { return true; } - PartyManager.joinParty(player, mcMMOPlayer, playerParty.getName(), password); + PartyManager.joinParty(player, mcMMOPlayer, targetParty, password); return true; default: