mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
We only need the name here, avoids NPE issues in /party create.
Fixes #655
This commit is contained in:
parent
340c47eebd
commit
a2cbfa2668
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user