From beb2b47162e51e574e6713afb4e60518f155105c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 18 Oct 2023 13:03:40 -0400 Subject: [PATCH] Collection used and old method deleted. --- src/engine/db/handlers/dbBuildingHandler.java | 29 ------------------- src/engine/objects/Building.java | 13 ++++----- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index e2becf1e..d1786e1f 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -489,35 +489,6 @@ public class dbBuildingHandler extends dbHandlerBase { } } - public void LOAD_ALL_CONDEMNED_FOR_BUILDING(Building building) { - - if (building == null) - return; - - try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `dyn_building_condemned` WHERE `buildingUID` = ?")) { - - preparedStatement.setInt(1, building.getObjectUUID()); - ResultSet rs = preparedStatement.executeQuery(); - - while (rs.next()) { - Condemned condemned = new Condemned(rs); - switch (condemned.friendType) { - case 2: - building.getCondemned().put(condemned.playerUID, condemned); - break; - case 4: - case 5: - building.getCondemned().put(condemned.guildUID, condemned); - break; - } - } - - } catch (SQLException e) { - Logger.error(e); - } - } - public ArrayList LOAD_PATROL_POINTS(Building building) { if (building == null) diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index 2c0f2c68..3acefafb 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -966,19 +966,16 @@ public class Building extends AbstractWorldObject { Logger.error("Failed to find Object Type for owner " + this.ownerUUID + " Location " + this.getLoc().toString()); } - this.friends = BuildingManager._buildingFriends.get(this.getObjectUUID()); + // Reference friend and condemn lists from BuildingManager - try { - DbManager.BuildingQueries.LOAD_ALL_CONDEMNED_FOR_BUILDING(this); - } catch (Exception e) { - Logger.error(this.getObjectUUID() + " failed to load friends/condemned." + e.getMessage()); - } + this.friends = BuildingManager._buildingFriends.get(this.getObjectUUID()); + this.condemned = BuildingManager._buildingCondemned.get(this.getObjectUUID()); //LOad Owners in Cache so we do not have to continuely look in the db for owner. if (this.ownerIsNPC) { - if (NPC.getNPC(this.ownerUUID) == null) - Logger.info("Building UID " + this.getObjectUUID() + " Failed to Load NPC Owner with ID " + this.ownerUUID + " Location " + this.getLoc().toString()); + if (NPC.getNPC(this.ownerUUID) == null) + Logger.info("Building UID " + this.getObjectUUID() + " Failed to Load NPC Owner with ID " + this.ownerUUID + " Location " + this.getLoc().toString()); } else if (this.ownerUUID != 0) { if (PlayerCharacter.getPlayerCharacter(this.ownerUUID) == null) {