Data populated at bootstrap.

This commit is contained in:
2023-11-09 14:44:44 -05:00
parent 21989da97c
commit 8dc51fa2f8
2 changed files with 26 additions and 1 deletions
+23 -1
View File
@@ -28,7 +28,6 @@ import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
@@ -550,6 +549,29 @@ public class dbBuildingHandler extends dbHandlerBase {
return false;
}
public void POPULATE_RENDER_LOOKUP() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_structure_renders`")) {
ResultSet rs = preparedStatement.executeQuery();
while (rs.next()) {
int structureID = rs.getInt("structureID");
int renderID = rs.getInt("renderID");
if (!BuildingManager._render_lookup.containsKey(structureID))
BuildingManager._render_lookup.put(structureID, new ArrayList<>());
BuildingManager._render_lookup.get(structureID).add(renderID);
}
} catch (SQLException e) {
Logger.error(e);
}
}
public void LOAD_MESH_HULLS() {
int recordsRead = 0;
+3
View File
@@ -403,6 +403,9 @@ public class WorldServer {
Logger.info("Loading building slot/stuck location data.");
BuildingLocation.loadBuildingLocations();
Logger.info("Populating structure to render lookup.");
DbManager.BuildingQueries.POPULATE_RENDER_LOOKUP();
Logger.info("Loading mesh hulls.");
DbManager.BuildingQueries.LOAD_MESH_HULLS();