mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-31 17:10:17 +02:00
Removed TPSTable#getNetworkOnlineData - not used
This commit is contained in:
parent
9f1479a65c
commit
6eafce05ba
|
@ -23,6 +23,7 @@ import com.djrapitops.plan.data.store.keys.ServerKeys;
|
|||
import com.djrapitops.plan.db.SQLDB;
|
||||
import com.djrapitops.plan.db.access.Query;
|
||||
import com.djrapitops.plan.db.access.queries.objects.ServerQueries;
|
||||
import com.djrapitops.plan.db.access.queries.objects.TPSQueries;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
|
||||
import java.util.Optional;
|
||||
|
@ -45,17 +46,17 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class NetworkContainerQuery implements Query<NetworkContainer> {
|
||||
|
||||
private static Query<ServerContainer> getBungeeServerContainer() {
|
||||
private static Query<ServerContainer> getProxyServerContainer() {
|
||||
return db -> {
|
||||
Optional<Server> proxyInformation = db.query(ServerQueries.fetchProxyServerInformation());
|
||||
if (!proxyInformation.isPresent()) {
|
||||
return new ServerContainer();
|
||||
}
|
||||
|
||||
UUID serverUUID = proxyInformation.get().getUuid();
|
||||
ServerContainer container = db.query(ContainerFetchQueries.fetchServerContainer(serverUUID));
|
||||
UUID proxyUUID = proxyInformation.get().getUuid();
|
||||
ServerContainer container = db.query(ContainerFetchQueries.fetchServerContainer(proxyUUID));
|
||||
container.putCachingSupplier(ServerKeys.PLAYERS, () -> db.query(ContainerFetchQueries.fetchAllPlayerContainers()));
|
||||
container.putCachingSupplier(ServerKeys.TPS, db.getTpsTable()::getNetworkOnlineData);
|
||||
container.putCachingSupplier(ServerKeys.TPS, () -> db.query(TPSQueries.fetchTPSDataOfServer(proxyUUID)));
|
||||
container.putSupplier(ServerKeys.WORLD_TIMES, null); // Additional Session information not supported
|
||||
container.putSupplier(ServerKeys.PLAYER_KILLS, null);
|
||||
container.putSupplier(ServerKeys.PLAYER_KILL_COUNT, null);
|
||||
|
@ -66,7 +67,7 @@ public class NetworkContainerQuery implements Query<NetworkContainer> {
|
|||
|
||||
@Override
|
||||
public NetworkContainer executeQuery(SQLDB db) {
|
||||
ServerContainer bungeeContainer = db.query(getBungeeServerContainer());
|
||||
ServerContainer bungeeContainer = db.query(getProxyServerContainer());
|
||||
NetworkContainer networkContainer = db.getNetworkContainerFactory().forBungeeContainer(bungeeContainer);
|
||||
networkContainer.putCachingSupplier(NetworkKeys.BUKKIT_SERVERS, () ->
|
||||
db.query(ServerQueries.fetchPlanServerInformation()).values()
|
||||
|
|
|
@ -21,15 +21,12 @@ import com.djrapitops.plan.data.container.builders.TPSBuilder;
|
|||
import com.djrapitops.plan.db.DBType;
|
||||
import com.djrapitops.plan.db.SQLDB;
|
||||
import com.djrapitops.plan.db.access.QueryAllStatement;
|
||||
import com.djrapitops.plan.db.access.QueryStatement;
|
||||
import com.djrapitops.plan.db.access.queries.objects.ServerQueries;
|
||||
import com.djrapitops.plan.db.sql.parsing.CreateTableParser;
|
||||
import com.djrapitops.plan.db.sql.parsing.Sql;
|
||||
import com.djrapitops.plan.system.info.server.Server;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import org.apache.commons.text.TextStringBuilder;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
@ -88,42 +85,6 @@ public class TPSTable extends Table {
|
|||
.toString();
|
||||
}
|
||||
|
||||
public List<TPS> getNetworkOnlineData() {
|
||||
Optional<Server> proxyInfo = db.query(ServerQueries.fetchProxyServerInformation());
|
||||
if (!proxyInfo.isPresent()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
UUID bungeeUUID = proxyInfo.get().getUuid();
|
||||
|
||||
String sql = "SELECT " +
|
||||
DATE + ", " +
|
||||
PLAYERS_ONLINE +
|
||||
" FROM " + TABLE_NAME +
|
||||
" WHERE " + SERVER_ID + "=" + ServerTable.STATEMENT_SELECT_SERVER_ID;
|
||||
|
||||
return query(new QueryStatement<List<TPS>>(sql, 50000) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
statement.setString(1, bungeeUUID.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TPS> processResults(ResultSet set) throws SQLException {
|
||||
List<TPS> tpsList = new ArrayList<>();
|
||||
while (set.next()) {
|
||||
|
||||
TPS tps = TPSBuilder.get()
|
||||
.date(set.getLong(DATE))
|
||||
.playersOnline(set.getInt(PLAYERS_ONLINE))
|
||||
.toTPS();
|
||||
|
||||
tpsList.add(tps);
|
||||
}
|
||||
return tpsList;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Map<Integer, List<TPS>> getPlayersOnlineForServers(Collection<Server> servers) {
|
||||
if (servers.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue
Block a user