From 5c70f1506479102d294cb2ab334f619a7bc45a15 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 31 May 2024 18:23:34 -0500 Subject: [PATCH] check player agro map for key before tryign to assign to it --- src/engine/objects/AbstractCharacter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index 6d90b66b..4d17992e 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -1809,7 +1809,13 @@ public abstract class AbstractCharacter extends AbstractWorldObject { //handle hate value addition Mob target = (Mob) this; if (attacker.getObjectType().equals(GameObjectType.PlayerCharacter)) { - target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value); + + if(target.playerAgroMap.containsKey(attacker.getObjectUUID())) + target.playerAgroMap.put(attacker.getObjectUUID(), target.playerAgroMap.get(attacker.getObjectUUID()) + value); + else + target.playerAgroMap.put(attacker.getObjectUUID(), value); + + if (target.isPlayerGuard()) { if (target.guardedCity != null && target.guardedCity.cityOutlaws.contains(attacker.getObjectUUID()) == false) target.guardedCity.cityOutlaws.add(attacker.getObjectUUID());