From c621a0ed07e81aa6f4f752ba45329540970546cd Mon Sep 17 00:00:00 2001 From: loganb1max Date: Sun, 5 Jan 2020 15:15:05 -0600 Subject: [PATCH] Fix NPE --- .../java/me/loganb1max/minionsplus/manager/MinionManager.java | 2 +- src/main/java/me/loganb1max/minionsplus/model/Minion.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/loganb1max/minionsplus/manager/MinionManager.java b/src/main/java/me/loganb1max/minionsplus/manager/MinionManager.java index e10580e..9b6a7dc 100644 --- a/src/main/java/me/loganb1max/minionsplus/manager/MinionManager.java +++ b/src/main/java/me/loganb1max/minionsplus/manager/MinionManager.java @@ -111,7 +111,7 @@ public class MinionManager implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onRightClick(final PlayerArmorStandManipulateEvent e) { - this.minions.stream().filter(minion -> minion.getId().equals(e.getRightClicked().getUniqueId())).findFirst().ifPresent(minion -> { + this.minions.stream().filter(minion -> minion.getId() != null).filter(minion -> minion.getId().equals(e.getRightClicked().getUniqueId())).findFirst().ifPresent(minion -> { e.setCancelled(true); if (!minion.getOwner().equals(e.getPlayer().getUniqueId())) { e.getPlayer().sendMessage(Text.color("&cOnly the owner of the minion can interact with it.")); diff --git a/src/main/java/me/loganb1max/minionsplus/model/Minion.java b/src/main/java/me/loganb1max/minionsplus/model/Minion.java index 3643272..b6ec96d 100644 --- a/src/main/java/me/loganb1max/minionsplus/model/Minion.java +++ b/src/main/java/me/loganb1max/minionsplus/model/Minion.java @@ -248,6 +248,7 @@ public abstract class Minion { toReturn = new BreederMinion(owner, ownerName, location, energy, level, linkedBlocks); break; } + toReturn.findStand(); return toReturn; }