From 409f8aa847bb00d299b31fe799ba52ff8c27039c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 17 Feb 2024 18:59:44 -0600 Subject: [PATCH] various console error fixes --- src/engine/loot/ModTableEntry.java | 9 +++++++-- src/engine/math/Bounds.java | 2 +- src/engine/mobileAI/MobAI.java | 5 ++++- .../net/client/handlers/ActivateNPCMsgHandler.java | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/engine/loot/ModTableEntry.java b/src/engine/loot/ModTableEntry.java index 86697880..d72f5f32 100644 --- a/src/engine/loot/ModTableEntry.java +++ b/src/engine/loot/ModTableEntry.java @@ -34,10 +34,15 @@ public class ModTableEntry { itemTableEntryList = LootManager._modTables.get(modTablwe); - for (ModTableEntry iteration : itemTableEntryList) + if(itemTableEntryList == null) + return null; + + for (ModTableEntry iteration : itemTableEntryList) { + if (iteration == null) + continue; if (roll >= iteration.minRoll && roll <= iteration.maxRoll) modTableEntry = iteration; - + } return modTableEntry; } } diff --git a/src/engine/math/Bounds.java b/src/engine/math/Bounds.java index 04998e1c..47bf9f07 100644 --- a/src/engine/math/Bounds.java +++ b/src/engine/math/Bounds.java @@ -220,7 +220,7 @@ public class Bounds { //player is inside building region, skip collision check. we only do collision from the outside. if (player.region != null && player.region.parentBuildingID == building.getObjectUUID()) continue; - if (building.getBounds().colliders == null) + if (building.getBounds() == null || building.getBounds().colliders == null) continue; for (Colliders collider : building.getBounds().colliders) { diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 6aed514a..1a26cd0b 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -155,7 +155,9 @@ public class MobAI { public static void AttackBuilding(Mob mob, Building target) { try { - + if(target == null){ + return; + } if (target.getRank() == -1 || !target.isVulnerable() || BuildingManager.getBuildingFromCache(target.getObjectUUID()) == null) { mob.setCombatTarget(null); return; @@ -202,6 +204,7 @@ public class MobAI { } } catch (Exception e) { + mob.setCombatTarget(null); Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: AttackBuilding" + " " + e.getMessage()); } } diff --git a/src/engine/net/client/handlers/ActivateNPCMsgHandler.java b/src/engine/net/client/handlers/ActivateNPCMsgHandler.java index 8614d51d..4e0179d7 100644 --- a/src/engine/net/client/handlers/ActivateNPCMsgHandler.java +++ b/src/engine/net/client/handlers/ActivateNPCMsgHandler.java @@ -126,7 +126,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler { return false; // Check if contract can be slotted in this building - Logger.error("inserting contract: " + contract.getContractID()); + //Logger.error("inserting contract: " + contract.getContractID()); if (contract.canSlotinBuilding(building) == false) { boolean override = false; if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL)) { @@ -152,7 +152,7 @@ public class ActivateNPCMsgHandler extends AbstractClientMsgHandler { return false; } } - Logger.error("override successful: " + contract.getContractID()); + //Logger.error("override successful: " + contract.getContractID()); if (!BuildingManager.addHireling(building, player, zone, contract, contractItem)) return false;