mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-10 00:13:42 -04:00
Made the SQL query in SpawnerService a field in order to make the code easier to read
This commit is contained in:
@@ -50,6 +50,9 @@ public final class SpawnerService extends Service {
|
||||
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;
|
||||
@@ -100,11 +103,7 @@ public final class SpawnerService extends Service {
|
||||
|
||||
private void loadSpawners() {
|
||||
try {
|
||||
ResultSet jointTable = spawnerDatabase.prepareStatement(
|
||||
"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"
|
||||
).executeQuery();
|
||||
ResultSet jointTable = spawnerDatabase.prepareStatement(QUERY).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