diff --git a/Changelog.txt b/Changelog.txt index 6d6632179..554351342 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -17,6 +17,7 @@ Version 1.4.04-dev = Fixed bug where Shake wouldn't damage mobs whose max health was less than 4 = Fixed bug where the API would fail if the name of a player's current party is requested when the player isn't in one (Thanks @dualspiral!) = Fixed bug with retrieving a player's party members + = Fixed bug which caused an NPE when trying to join a non-existing player ! Updated localization files - Removed deprecated functions from API classes. - Removed functions for getting the PlayerProfile - using API classes is preferred, but if not the McMMOPlayer should be used instead diff --git a/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java b/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java index ef77847de..d01befcd6 100644 --- a/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java @@ -31,6 +31,9 @@ public class PartyJoinCommand implements CommandExecutor { return true; } + mcMMOPlayer = UserManager.getPlayer(args[1]); + player = mcMMOPlayer.getPlayer(); + String password = getPassword(args); // Make sure party passwords match @@ -63,8 +66,8 @@ public class PartyJoinCommand implements CommandExecutor { private boolean canJoinParty(CommandSender sender, String targetName) { mcMMOTarget = UserManager.getPlayer(targetName); - if (CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { - return true; + if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) { + return false; } target = mcMMOTarget.getPlayer(); diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java index 901ec1912..ed559efd4 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandUtils.java @@ -67,17 +67,17 @@ public final class CommandUtils { public static boolean checkPlayerExistence(CommandSender sender, String playerName, McMMOPlayer mcMMOPlayer) { if (mcMMOPlayer != null) { - return false; + return true; } PlayerProfile playerProfile = new PlayerProfile(playerName, false); if (unloadedProfile(sender, playerProfile)) { - return true; + return false; } sender.sendMessage(LocaleLoader.getString("Commands.Offline")); - return true; + return false; } public static boolean unloadedProfile(CommandSender sender, PlayerProfile profile) {