From dceee5554d3241123e3ea656ee25c633a7c86203 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Tue, 28 Jan 2020 16:32:28 +0000 Subject: [PATCH] Fix CombatUtils NPE due to arrows from unloaded players --- .../com/gmail/nossr50/listeners/EntityListener.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 17e18fb4d..2f191cc6e 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -381,12 +381,15 @@ public class EntityListener implements Listener { } //Deflect checks - UnarmedManager unarmedManager = UserManager.getPlayer(defendingPlayer).getUnarmedManager(); + final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(defendingPlayer); + if (mcMMOPlayer != null) { + UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager(); - if (unarmedManager.canDeflect()) { - if(unarmedManager.deflectCheck()) { - event.setCancelled(true); - return; + if (unarmedManager.canDeflect()) { + if (unarmedManager.deflectCheck()) { + event.setCancelled(true); + return; + } } } } else {