mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-31 14:49:35 +01:00
Fix possible NPE when using the PartyAPI to add a player to a party that
doesn't exist.
This commit is contained in:
parent
a6446563d8
commit
38a8a6f2ff
@ -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
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user