mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-19 09:05:26 +01:00
Made WorldTimesTable static information class:
- Made WorldTimesTable constructor private - Removed getter in SQLDB
This commit is contained in:
parent
038d0354a0
commit
2d5f9254ed
@ -79,7 +79,6 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
private final KillsTable killsTable;
|
||||
private final SessionsTable sessionsTable;
|
||||
private final TPSTable tpsTable;
|
||||
private final WorldTimesTable worldTimesTable;
|
||||
private final ServerTable serverTable;
|
||||
private final SettingsTable settingsTable;
|
||||
|
||||
@ -115,7 +114,6 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
userInfoTable = new UserInfoTable(this);
|
||||
sessionsTable = new SessionsTable(this);
|
||||
killsTable = new KillsTable(this);
|
||||
worldTimesTable = new WorldTimesTable(this);
|
||||
settingsTable = new SettingsTable(this);
|
||||
|
||||
fetchOps = new SQLFetchOps(this);
|
||||
@ -360,11 +358,6 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
return tpsTable;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public WorldTimesTable getWorldTimesTable() {
|
||||
return worldTimesTable;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ServerTable getServerTable() {
|
||||
return serverTable;
|
||||
|
@ -81,19 +81,16 @@ public class WorldsServerIDPatch extends Patch {
|
||||
}
|
||||
|
||||
private Set<String> getWorldNamesOld(UUID serverUUID) {
|
||||
WorldTimesTable worldTimesTable = db.getWorldTimesTable();
|
||||
SessionsTable sessionsTable = db.getSessionsTable();
|
||||
|
||||
String worldIDColumn = worldTimesTable + "." + WorldTimesTable.WORLD_ID;
|
||||
String worldSessionIDColumn = worldTimesTable + "." + WorldTimesTable.SESSION_ID;
|
||||
String sessionIDColumn = sessionsTable + "." + SessionsTable.ID;
|
||||
String sessionServerUUIDColumn = sessionsTable + "." + SessionsTable.SERVER_UUID;
|
||||
String worldIDColumn = WorldTimesTable.TABLE_NAME + "." + WorldTimesTable.WORLD_ID;
|
||||
String worldSessionIDColumn = WorldTimesTable.TABLE_NAME + "." + WorldTimesTable.SESSION_ID;
|
||||
String sessionIDColumn = SessionsTable.TABLE_NAME + "." + SessionsTable.ID;
|
||||
String sessionServerUUIDColumn = SessionsTable.TABLE_NAME + "." + SessionsTable.SERVER_UUID;
|
||||
|
||||
String sql = "SELECT DISTINCT " +
|
||||
WorldTable.NAME + " FROM " +
|
||||
WorldTable.TABLE_NAME +
|
||||
" INNER JOIN " + worldTimesTable + " on " + worldIDColumn + "=" + WorldTable.TABLE_NAME + "." + WorldTable.ID +
|
||||
" INNER JOIN " + sessionsTable + " on " + worldSessionIDColumn + "=" + sessionIDColumn +
|
||||
" INNER JOIN " + WorldTimesTable.TABLE_NAME + " on " + worldIDColumn + "=" + WorldTable.TABLE_NAME + "." + WorldTable.ID +
|
||||
" INNER JOIN " + SessionsTable.TABLE_NAME + " on " + worldSessionIDColumn + "=" + sessionIDColumn +
|
||||
" WHERE " + sessionServerUUIDColumn + "=?";
|
||||
|
||||
return query(new QueryStatement<Set<String>>(sql, 1000) {
|
||||
@ -126,8 +123,7 @@ public class WorldsServerIDPatch extends Patch {
|
||||
.collect(Collectors.toList()
|
||||
)));
|
||||
|
||||
WorldTimesTable worldTimesTable = db.getWorldTimesTable();
|
||||
String sql = "UPDATE " + worldTimesTable + " SET " +
|
||||
String sql = "UPDATE " + WorldTimesTable.TABLE_NAME + " SET " +
|
||||
WorldTimesTable.WORLD_ID + "=?" +
|
||||
" WHERE " + WorldTimesTable.WORLD_ID + "=?" +
|
||||
" AND " + "server_id=?";
|
||||
|
@ -20,7 +20,6 @@ import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||
import com.djrapitops.plan.data.time.GMTimes;
|
||||
import com.djrapitops.plan.db.DBType;
|
||||
import com.djrapitops.plan.db.SQLDB;
|
||||
import com.djrapitops.plan.db.patches.Version10Patch;
|
||||
import com.djrapitops.plan.db.patches.WorldTimesOptimizationPatch;
|
||||
import com.djrapitops.plan.db.patches.WorldTimesSeverIDPatch;
|
||||
@ -31,13 +30,10 @@ import com.djrapitops.plan.db.sql.parsing.Sql;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Table that is in charge of storing playtime data for each world in each GameMode.
|
||||
* <p>
|
||||
* Table Name: plan_world_times
|
||||
* Information about database table 'plan_world_times'.
|
||||
* <p>
|
||||
* Patches related to this table:
|
||||
* {@link Version10Patch}
|
||||
@ -47,7 +43,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class WorldTimesTable extends Table {
|
||||
public class WorldTimesTable {
|
||||
|
||||
public static final String TABLE_NAME = "plan_world_times";
|
||||
|
||||
@ -75,8 +71,8 @@ public class WorldTimesTable extends Table {
|
||||
WorldTable.SELECT_WORLD_ID_STATEMENT + ", " +
|
||||
"?, ?, ?, ?, ?, ?)";
|
||||
|
||||
public WorldTimesTable(SQLDB db) {
|
||||
super(TABLE_NAME, db);
|
||||
private WorldTimesTable() {
|
||||
/* Static information class */
|
||||
}
|
||||
|
||||
public static String createTableSQL(DBType dbType) {
|
||||
@ -122,16 +118,4 @@ public class WorldTimesTable extends Table {
|
||||
statement.addBatch();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof WorldTimesTable)) return false;
|
||||
return super.equals(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode());
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ public class SQLOps {
|
||||
protected final KillsTable killsTable;
|
||||
protected final SessionsTable sessionsTable;
|
||||
protected final TPSTable tpsTable;
|
||||
protected final WorldTimesTable worldTimesTable;
|
||||
protected final ServerTable serverTable;
|
||||
protected final SettingsTable settingsTable;
|
||||
|
||||
@ -41,7 +40,6 @@ public class SQLOps {
|
||||
killsTable = db.getKillsTable();
|
||||
sessionsTable = db.getSessionsTable();
|
||||
tpsTable = db.getTpsTable();
|
||||
worldTimesTable = db.getWorldTimesTable();
|
||||
serverTable = db.getServerTable();
|
||||
settingsTable = db.getSettingsTable();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user