From a2cbfa266897414c0a1adda8fd0ddd9e55e5d17b Mon Sep 17 00:00:00 2001 From: GJ Date: Sat, 9 Feb 2013 00:57:00 -0500 Subject: [PATCH] We only need the name here, avoids NPE issues in /party create. Fixes #655 --- src/main/java/com/gmail/nossr50/party/PartyManager.java | 6 +++--- .../gmail/nossr50/party/commands/PartyAcceptCommand.java | 2 +- .../gmail/nossr50/party/commands/PartyCreateCommand.java | 2 +- .../com/gmail/nossr50/party/commands/PartyJoinCommand.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/party/PartyManager.java b/src/main/java/com/gmail/nossr50/party/PartyManager.java index 97a8bb8eb..56878c3f1 100644 --- a/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -21,15 +21,15 @@ public final class PartyManager { private PartyManager() {} - public static boolean changeOrJoinParty(McMMOPlayer mcMMOPlayer, Player player, Party oldParty, Party newParty) { + public static boolean changeOrJoinParty(McMMOPlayer mcMMOPlayer, Player player, Party oldParty, String newPartyName) { if (mcMMOPlayer.inParty()) { - if (!handlePartyChangeEvent(player, oldParty.getName(), newParty.getName(), EventReason.CHANGED_PARTIES)) { + if (!handlePartyChangeEvent(player, oldParty.getName(), newPartyName, EventReason.CHANGED_PARTIES)) { return false; } removeFromParty(player.getName(), oldParty); } - else if (!handlePartyChangeEvent(player, null, newParty.getName(), EventReason.JOINED_PARTY)) { + else if (!handlePartyChangeEvent(player, null, newPartyName, EventReason.JOINED_PARTY)) { return false; } diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyAcceptCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyAcceptCommand.java index 9d0b5a864..ef65d9231 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyAcceptCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyAcceptCommand.java @@ -34,7 +34,7 @@ public class PartyAcceptCommand implements CommandExecutor { // Changing parties - if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, mcMMOPlayer.getParty(), mcMMOPlayer.getPartyInvite())) { + if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, mcMMOPlayer.getParty(), mcMMOPlayer.getPartyInvite().getName())) { return true; } diff --git a/src/main/java/com/gmail/nossr50/party/commands/PartyCreateCommand.java b/src/main/java/com/gmail/nossr50/party/commands/PartyCreateCommand.java index e57d91966..d71bf8ef8 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyCreateCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyCreateCommand.java @@ -38,7 +38,7 @@ public class PartyCreateCommand implements CommandExecutor { mcMMOPlayer = Users.getPlayer(player); // Changing parties - if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, mcMMOPlayer.getParty(), newParty)) { + if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, mcMMOPlayer.getParty(), args[1])) { return true; } 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 eec86f601..7fc4f7acf 100644 --- a/src/main/java/com/gmail/nossr50/party/commands/PartyJoinCommand.java +++ b/src/main/java/com/gmail/nossr50/party/commands/PartyJoinCommand.java @@ -45,7 +45,7 @@ public class PartyJoinCommand implements CommandExecutor { } // Changing parties - if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, playerParty, targetParty)) { + if (!PartyManager.changeOrJoinParty(mcMMOPlayer, player, playerParty, targetParty.getName())) { return true; }