From 7ce94a51660014f5218b868325660a3a1e099cd6 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 20 Oct 2023 09:48:24 -0400 Subject: [PATCH] should never pull directly form cache --- src/engine/mobileAI/MobAI.java | 6 +++--- src/engine/objects/Building.java | 5 +++-- src/engine/objects/City.java | 7 ------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index c50fd941..22cd65dd 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -657,7 +657,7 @@ public class MobAI { for (Entry playerEntry : loadedPlayers.entrySet()) { int playerID = (int) playerEntry.getKey(); - PlayerCharacter loadedPlayer = PlayerCharacter.getFromCache(playerID); + PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID); //Player is null, let's remove them from the list. @@ -1105,7 +1105,7 @@ public class MobAI { for (Entry playerEntry : loadedPlayers.entrySet()) { int playerID = (int) playerEntry.getKey(); - PlayerCharacter loadedPlayer = PlayerCharacter.getFromCache(playerID); + PlayerCharacter loadedPlayer = PlayerCharacter.getPlayerCharacter(playerID); //Player is null, let's remove them from the list. @@ -1280,7 +1280,7 @@ public class MobAI { for (Entry playerEntry : mob.playerAgroMap.entrySet()) { - PlayerCharacter potentialTarget = PlayerCharacter.getFromCache((int) playerEntry.getKey()); + PlayerCharacter potentialTarget = PlayerCharacter.getPlayerCharacter((int) playerEntry.getKey()); if (potentialTarget.equals(mob.getCombatTarget())) continue; diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index b60415e3..b288f0e2 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -807,10 +807,11 @@ public class Building extends AbstractWorldObject { if (this.ownerUUID == 0) return null; + if (this.ownerIsNPC) - return NPC.getFromCache(this.ownerUUID); + return NPC.getNPC(this.ownerUUID); - return PlayerCharacter.getFromCache(this.ownerUUID); + return PlayerCharacter.getPlayerCharacter(this.ownerUUID); } diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index a27dc5a8..1b12ee4d 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -868,7 +868,6 @@ public class City extends AbstractWorldObject { player.addCityEffect(Integer.toString(effectBase.getUUID()), effectBase, rank, MBServerStatics.FOURTYFIVE_SECONDS, false, this); } - } public Warehouse getWarehouse() { @@ -894,12 +893,6 @@ public class City extends AbstractWorldObject { return collided; } - public boolean isLocationOnCityGrid(Bounds newBounds) { - - boolean collided = Bounds.collide(this.getBounds(), newBounds, 0); - return collided; - } - public boolean isLocationWithinSiegeBounds(Vector3fImmutable insideLoc) { return insideLoc.isInsideCircle(this.getLoc(), CityBoundsType.ZONE.halfExtents);