Fix CombatUtils NPE due to arrows from unloaded players

This commit is contained in:
Shane Freeder 2020-01-28 16:32:28 +00:00
parent 8094be46c8
commit dceee5554d
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -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 {