Fix /party teleport NPE (#4885)

This commit is contained in:
Warrior 2023-04-04 02:48:01 +02:00 committed by GitHub
parent 79730383ab
commit 606a92f1ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,15 +200,19 @@ public class PartyCommand implements TabExecutor {
if (matches.size() == 0) {
Player player = (Player) sender;
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not Loaded
if(UserManager.getPlayer(player) == null)
if(mcMMOPlayer == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
Party party = UserManager.getPlayer(player).getParty();
if (mcMMOPlayer.getParty() == null)
return ImmutableList.of();
final Party party = mcMMOPlayer.getParty();
playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));