From b5cade37934db5fb0e92a6e4c21289ef9352cf89 Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Sun, 10 Feb 2019 19:06:00 +0100 Subject: [PATCH] Avoid NPE --- .../factions/engine/EngineCanCombatHappen.java | 7 +++++-- src/com/massivecraft/factions/entity/MPlayer.java | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/massivecraft/factions/engine/EngineCanCombatHappen.java b/src/com/massivecraft/factions/engine/EngineCanCombatHappen.java index 390565c5..3b237651 100644 --- a/src/com/massivecraft/factions/engine/EngineCanCombatHappen.java +++ b/src/com/massivecraft/factions/engine/EngineCanCombatHappen.java @@ -110,8 +110,11 @@ public class EngineCanCombatHappen extends Engine Faction defenderPsFaction = BoardColl.get().getFactionAt(defenderPs); // ... fast evaluate if the attacker is overriding ... - MPlayer mplayer = MPlayer.get(eattacker); - if (mplayer != null && mplayer.isOverriding()) return true; + if (MUtil.isPlayer(eattacker)) + { + MPlayer mplayer = MPlayer.get(eattacker); + if (mplayer != null && mplayer.isOverriding()) return true; + } // ... PVP flag may cause a damage block ... if (defenderPsFaction.getFlag(MFlag.getFlagPvp()) == false) diff --git a/src/com/massivecraft/factions/entity/MPlayer.java b/src/com/massivecraft/factions/entity/MPlayer.java index 096d62d5..040e1e3a 100644 --- a/src/com/massivecraft/factions/entity/MPlayer.java +++ b/src/com/massivecraft/factions/entity/MPlayer.java @@ -43,7 +43,8 @@ public class MPlayer extends SenderEntity implements FactionsParticipat // META // -------------------------------------------- // - public static MPlayer get(Object oid) { + public static MPlayer get(Object oid) + { return MPlayerColl.get().get(oid); }