Browse Source

Data populated at bootstrap.

hull4
MagicBot 1 year ago
parent
commit
8dc51fa2f8
  1. 24
      src/engine/db/handlers/dbBuildingHandler.java
  2. 3
      src/engine/server/world/WorldServer.java

24
src/engine/db/handlers/dbBuildingHandler.java

@ -28,7 +28,6 @@ import java.sql.SQLException; @@ -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 { @@ -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
src/engine/server/world/WorldServer.java

@ -403,6 +403,9 @@ public class WorldServer { @@ -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();

Loading…
Cancel
Save