Fix possible NPE when using the PartyAPI to add a player to a party that

doesn't exist.
This commit is contained in:
GJ 2013-01-17 11:26:55 -05:00
parent a6446563d8
commit 38a8a6f2ff
2 changed files with 11 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Version 1.3.13-dev
+ Added wooden button to the list of items that shouldn't trigger abilities + Added wooden button to the list of items that shouldn't trigger abilities
+ Added a new feature to fishing. Players will have +10% chance of finding enchanted items when fishing while it's raining + Added a new feature to fishing. Players will have +10% chance of finding enchanted items when fishing while it's raining
+ Added displaying bonus perks on skill commands + Added displaying bonus perks on skill commands
= Fix possible NPE when using the PartyAPI to add a player to a party that doesn't exist.
= Fix mcremove command for mySQL = Fix mcremove command for mySQL
= Impact now works with mobs wearing armor = Impact now works with mobs wearing armor
= Fixed issue with Tree Feller dropping player-placed blocks = Fixed issue with Tree Feller dropping player-placed blocks

View File

@ -69,7 +69,16 @@ public final class PartyAPI {
* @param partyName The party to add the player to * @param partyName The party to add the player to
*/ */
public static void addToParty(Player player, String partyName) { public static void addToParty(Player player, String partyName) {
PartyManager.getInstance().addToParty(player.getName(), Users.getProfile(player), PartyManager.getInstance().getParty(partyName)); //TODO this will throw a NPE if the party doesn't exist Party party = PartyManager.getInstance().getParty(partyName);
String playerName = player.getName();
if (party == null) {
party = new Party();
party.setName(partyName);
party.setLeader(playerName);
}
PartyManager.getInstance().addToParty(playerName, Users.getProfile(player), party);
} }
/** /**