mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-19 08:55:26 +01:00
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.
This commit is contained in:
parent
46b5746dcc
commit
ccedd23342
@ -287,27 +287,11 @@ public final class PartyManager {
|
|||||||
*
|
*
|
||||||
* @param player The player to add to the party
|
* @param player The player to add to the party
|
||||||
* @param mcMMOPlayer 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
|
* @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) {
|
public static void joinParty(Player player, McMMOPlayer mcMMOPlayer, Party party, String password) {
|
||||||
partyName = partyName.replace(".", "");
|
if (!checkPartyPassword(player, party, password)) {
|
||||||
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)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PartyManager.joinParty(player, mcMMOPlayer, playerParty.getName(), password);
|
PartyManager.joinParty(player, mcMMOPlayer, targetParty, password);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user