npcunaggroarea: Local Player NPE Fix (#1350)

* Add local player null check

* final for Ganom
This commit is contained in:
Netami1
2019-08-15 17:55:04 -04:00
committed by Kyleeld
parent dd3809c495
commit eb8c6ec544

View File

@@ -307,9 +307,15 @@ public class NpcAggroAreaPlugin extends Plugin
// Most NPCs stop aggroing when the player has more than double // Most NPCs stop aggroing when the player has more than double
// its combat level. // its combat level.
int playerLvl = client.getLocalPlayer().getCombatLevel(); final Player localPlayer = client.getLocalPlayer();
int npcLvl = composition.getCombatLevel(); if (localPlayer == null)
String npcName = composition.getName().toLowerCase(); {
return false;
}
final int playerLvl = localPlayer.getCombatLevel();
final int npcLvl = composition.getCombatLevel();
final String npcName = composition.getName().toLowerCase();
if (npcLvl > 0 && playerLvl > npcLvl * 2 && !isInWilderness(npc.getWorldLocation())) if (npcLvl > 0 && playerLvl > npcLvl * 2 && !isInWilderness(npc.getWorldLocation()))
{ {
return false; return false;