From 6fb1e2e5f1e2aa6447628831ecf5d73e1d81393f Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 18 Oct 2023 12:31:39 -0400 Subject: [PATCH] Load collection from db --- src/engine/db/handlers/dbBuildingHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index 8d5c331d..b8ddb0e2 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -28,6 +28,7 @@ import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; public class dbBuildingHandler extends dbHandlerBase { @@ -435,6 +436,11 @@ public class dbBuildingHandler extends dbHandlerBase { while (rs.next()) { BuildingFriends friend = new BuildingFriends(rs); + // Create map if it does not yet exist + + if (!BuildingManager._buildingFriends.containsKey(friend.buildingUID)) + BuildingManager._buildingFriends.put(friend.buildingUID, new ConcurrentHashMap<>()); + switch (friend.friendType) { case 7: BuildingManager._buildingFriends.get(friend.buildingUID).put(friend.playerUID, friend);