diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 672a3d87..3fe97f9b 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -310,11 +310,9 @@ public enum BuildingManager { public static void removeHireling(Building building, AbstractCharacter hireling) { - Mob guardCaptain = null; - if (hireling.getObjectType().equals(GameObjectType.Mob)) { - guardCaptain = (Mob) hireling; + Mob guardCaptain = (Mob) hireling; // Clear minions from database if a guard captain @@ -338,6 +336,12 @@ public enum BuildingManager { building.getHirelings().remove(hireling); + // Unload hireling from world + + DbManager.removeFromCache(hireling); + WorldGrid.RemoveWorldObject(hireling); + WorldGrid.removeObject(hireling); + // Delete hireling from database if (hireling.getObjectType().equals(GameObjectType.Mob)) @@ -345,12 +349,6 @@ public enum BuildingManager { else DbManager.NPCQueries.DELETE_NPC((NPC) hireling); - // Unload hireling from world - - DbManager.removeFromCache(hireling); - WorldGrid.RemoveWorldObject(hireling); - WorldGrid.removeObject(hireling); - }