mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-08 23:13:25 -04:00
Fixed an issue where a ResultSet in SpawnerService was never closed
This commit is contained in:
@@ -47,12 +47,14 @@ import services.objects.ObjectManager;
|
||||
|
||||
public final class SpawnerService extends Service {
|
||||
|
||||
private static final String GET_ALL_SPAWNERS_SQL =
|
||||
"SELECT static.*, buildings.object_id, buildings.terrain_name FROM static "
|
||||
+ "INNER JOIN buildings ON static.building_id = buildings.building_id "
|
||||
+ "GROUP BY buildings.building_id";
|
||||
|
||||
private final ObjectManager objectManager;
|
||||
private final Collection<Spawner> spawners;
|
||||
private final RelationalServerData spawnerDatabase;
|
||||
private static final String QUERY = "SELECT static.*, buildings.object_id, buildings.terrain_name FROM static "
|
||||
+ "INNER JOIN buildings ON static.building_id = buildings.building_id "
|
||||
+ "GROUP BY buildings.building_id";
|
||||
|
||||
public SpawnerService(ObjectManager objectManager) {
|
||||
this.objectManager = objectManager;
|
||||
@@ -102,8 +104,7 @@ public final class SpawnerService extends Service {
|
||||
}
|
||||
|
||||
private void loadSpawners() {
|
||||
try {
|
||||
ResultSet jointTable = spawnerDatabase.prepareStatement(QUERY).executeQuery();
|
||||
try(ResultSet jointTable = spawnerDatabase.prepareStatement(GET_ALL_SPAWNERS_SQL).executeQuery()) {
|
||||
while (jointTable.next()) {
|
||||
if(jointTable.getBoolean("active")) {
|
||||
Location loc = new Location(jointTable.getFloat("x"), jointTable.getFloat("y"), jointTable.getFloat("z"), Terrain.valueOf(jointTable.getString("terrain_name")));
|
||||
|
||||
Reference in New Issue
Block a user