mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-07 04:18:26 +02:00
Removed FetchOperations & NetworkContainer
This commit is contained in:
parent
93314239c9
commit
de8f46f84c
@ -25,8 +25,6 @@ import com.djrapitops.plan.db.access.queries.containers.ContainerFetchQueries;
|
|||||||
import com.djrapitops.plan.db.access.queries.objects.ServerQueries;
|
import com.djrapitops.plan.db.access.queries.objects.ServerQueries;
|
||||||
import com.djrapitops.plan.db.access.queries.objects.UserIdentifierQueries;
|
import com.djrapitops.plan.db.access.queries.objects.UserIdentifierQueries;
|
||||||
import com.djrapitops.plan.system.database.DBSystem;
|
import com.djrapitops.plan.system.database.DBSystem;
|
||||||
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
|
||||||
import com.djrapitops.plan.system.database.databases.sql.operation.SQLFetchOps;
|
|
||||||
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
|
||||||
import com.djrapitops.plugin.logging.L;
|
import com.djrapitops.plugin.logging.L;
|
||||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||||
@ -118,15 +116,6 @@ public class CommonAPI implements PlanAPI {
|
|||||||
return queryDB(UserIdentifierQueries.fetchPlayerNameOf(playerUUID)).orElse(null);
|
return queryDB(UserIdentifierQueries.fetchPlayerNameOf(playerUUID)).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FetchOperations fetchFromPlanDB() {
|
|
||||||
logger.warn("PlanAPI#fetchFromPlanDB has been deprecated and will be removed in the future. Stack trace to follow");
|
|
||||||
for (StackTraceElement element : Thread.currentThread().getStackTrace()) {
|
|
||||||
logger.warn(element.toString());
|
|
||||||
}
|
|
||||||
return new SQLFetchOps(dbSystem.getDatabase());
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T> T queryDB(Query<T> query) {
|
private <T> T queryDB(Query<T> query) {
|
||||||
return dbSystem.getDatabase().query(query);
|
return dbSystem.getDatabase().query(query);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ package com.djrapitops.plan.api;
|
|||||||
import com.djrapitops.plan.api.data.PlayerContainer;
|
import com.djrapitops.plan.api.data.PlayerContainer;
|
||||||
import com.djrapitops.plan.api.data.ServerContainer;
|
import com.djrapitops.plan.api.data.ServerContainer;
|
||||||
import com.djrapitops.plan.data.plugin.PluginData;
|
import com.djrapitops.plan.data.plugin.PluginData;
|
||||||
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -66,15 +65,6 @@ public interface PlanAPI {
|
|||||||
|
|
||||||
Map<UUID, String> getKnownPlayerNames();
|
Map<UUID, String> getKnownPlayerNames();
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch things from the database.
|
|
||||||
*
|
|
||||||
* @return FetchOperations object.
|
|
||||||
* @deprecated FetchOperations interface is going to removed since it is too rigid.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
FetchOperations fetchFromPlanDB();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch PlayerContainer from the database.
|
* Fetch PlayerContainer from the database.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -1,280 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Player Analytics (Plan).
|
|
||||||
*
|
|
||||||
* Plan is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Plan is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.data.store.containers;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.data.container.TPS;
|
|
||||||
import com.djrapitops.plan.data.store.Key;
|
|
||||||
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
|
||||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
|
||||||
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
|
||||||
import com.djrapitops.plan.data.store.mutators.TPSMutator;
|
|
||||||
import com.djrapitops.plan.db.Database;
|
|
||||||
import com.djrapitops.plan.db.access.queries.ServerAggregateQueries;
|
|
||||||
import com.djrapitops.plan.db.access.queries.objects.GeoInfoQueries;
|
|
||||||
import com.djrapitops.plan.db.access.queries.objects.TPSQueries;
|
|
||||||
import com.djrapitops.plan.system.database.DBSystem;
|
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
|
||||||
import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
|
||||||
import com.djrapitops.plan.system.locale.Locale;
|
|
||||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
|
||||||
import com.djrapitops.plan.system.settings.paths.ProxySettings;
|
|
||||||
import com.djrapitops.plan.system.settings.paths.TimeSettings;
|
|
||||||
import com.djrapitops.plan.system.settings.theme.Theme;
|
|
||||||
import com.djrapitops.plan.system.settings.theme.ThemeVal;
|
|
||||||
import com.djrapitops.plan.utilities.formatting.Formatters;
|
|
||||||
import com.djrapitops.plan.utilities.html.graphs.Graphs;
|
|
||||||
import com.djrapitops.plan.utilities.html.graphs.bar.BarGraph;
|
|
||||||
import com.djrapitops.plan.utilities.html.graphs.stack.StackGraph;
|
|
||||||
import com.djrapitops.plan.utilities.html.structure.NetworkServerBox;
|
|
||||||
import com.djrapitops.plugin.api.Check;
|
|
||||||
import com.djrapitops.plugin.api.TimeAmount;
|
|
||||||
import dagger.Lazy;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DataContainer for the whole network.
|
|
||||||
*
|
|
||||||
* @author Rsl1122
|
|
||||||
* @see com.djrapitops.plan.data.store.keys.NetworkKeys for Key objects
|
|
||||||
* @see com.djrapitops.plan.data.store.PlaceholderKey for placeholder information
|
|
||||||
*/
|
|
||||||
public class NetworkContainer extends DynamicDataContainer {
|
|
||||||
|
|
||||||
private final ServerContainer bungeeContainer;
|
|
||||||
|
|
||||||
private final String version;
|
|
||||||
private final PlanConfig config;
|
|
||||||
private final Locale locale;
|
|
||||||
private final Theme theme;
|
|
||||||
private final ServerProperties serverProperties;
|
|
||||||
private final Formatters formatters;
|
|
||||||
private final Graphs graphs;
|
|
||||||
private final Database database;
|
|
||||||
|
|
||||||
public NetworkContainer(
|
|
||||||
ServerContainer bungeeContainer,
|
|
||||||
String version,
|
|
||||||
PlanConfig config,
|
|
||||||
Locale locale,
|
|
||||||
Theme theme,
|
|
||||||
DBSystem dbSystem,
|
|
||||||
ServerProperties serverProperties,
|
|
||||||
Formatters formatters,
|
|
||||||
Graphs graphs
|
|
||||||
) {
|
|
||||||
this.bungeeContainer = bungeeContainer;
|
|
||||||
this.version = version;
|
|
||||||
this.config = config;
|
|
||||||
this.locale = locale;
|
|
||||||
this.theme = theme;
|
|
||||||
this.database = dbSystem.getDatabase();
|
|
||||||
this.serverProperties = serverProperties;
|
|
||||||
this.formatters = formatters;
|
|
||||||
this.graphs = graphs;
|
|
||||||
|
|
||||||
putCachingSupplier(NetworkKeys.PLAYERS_MUTATOR, () -> PlayersMutator.forContainer(bungeeContainer));
|
|
||||||
|
|
||||||
addConstants();
|
|
||||||
addServerBoxes();
|
|
||||||
addPlayerInformation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addServerBoxes() {
|
|
||||||
putSupplier(NetworkKeys.NETWORK_PLAYER_ONLINE_DATA, () -> database.query(TPSQueries.fetchPlayerOnlineDataOfServers(
|
|
||||||
getValue(NetworkKeys.BUKKIT_SERVERS).orElse(new ArrayList<>()))
|
|
||||||
));
|
|
||||||
putSupplier(NetworkKeys.SERVERS_TAB, () -> {
|
|
||||||
StringBuilder serverBoxes = new StringBuilder();
|
|
||||||
Map<Integer, List<TPS>> playersOnlineData = getValue(NetworkKeys.NETWORK_PLAYER_ONLINE_DATA).orElse(new HashMap<>());
|
|
||||||
Map<UUID, Integer> userCounts = database.query(ServerAggregateQueries.serverUserCounts());
|
|
||||||
Collection<Server> servers = getValue(NetworkKeys.BUKKIT_SERVERS).orElse(new ArrayList<>());
|
|
||||||
servers.stream()
|
|
||||||
.sorted((one, two) -> String.CASE_INSENSITIVE_ORDER.compare(one.getName(), two.getName()))
|
|
||||||
.forEach(server -> {
|
|
||||||
TPSMutator tpsMutator = new TPSMutator(playersOnlineData.getOrDefault(server.getId(), new ArrayList<>()));
|
|
||||||
int registered = userCounts.getOrDefault(server.getUuid(), 0);
|
|
||||||
NetworkServerBox serverBox = new NetworkServerBox(server, registered, tpsMutator, graphs);
|
|
||||||
serverBoxes.append(serverBox.toHtml());
|
|
||||||
});
|
|
||||||
if (servers.isEmpty()) {
|
|
||||||
serverBoxes.append("<div class=\"row clearfix\">" +
|
|
||||||
"<div class=\"col-xs-12 col-sm-12 col-md-12 col-lg-12\">" +
|
|
||||||
"<div class=\"card\">" +
|
|
||||||
"<div class=\"header\">" +
|
|
||||||
"<div class=\"row clearfix\">" +
|
|
||||||
"<div class=\"col-xs-6 col-sm-6 col-lg-6\">" +
|
|
||||||
"<h2><i class=\"col-light-green fa fa-servers\"></i> No Servers</h2>" +
|
|
||||||
"</div><div class=\"body\">" +
|
|
||||||
"<p>No Bukkit/Sponge servers connected to Plan.</p>" +
|
|
||||||
"</div></div></div></div></div></div>");
|
|
||||||
}
|
|
||||||
return serverBoxes.toString();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addConstants() {
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
putRawData(NetworkKeys.REFRESH_TIME, now);
|
|
||||||
putRawData(NetworkKeys.REFRESH_TIME_DAY_AGO, getUnsafe(NetworkKeys.REFRESH_TIME) - TimeUnit.DAYS.toMillis(1L));
|
|
||||||
putRawData(NetworkKeys.REFRESH_TIME_WEEK_AGO, getUnsafe(NetworkKeys.REFRESH_TIME) - TimeAmount.WEEK.toMillis(1L));
|
|
||||||
putRawData(NetworkKeys.REFRESH_TIME_MONTH_AGO, getUnsafe(NetworkKeys.REFRESH_TIME) - TimeAmount.MONTH.toMillis(1L));
|
|
||||||
putSupplier(NetworkKeys.REFRESH_TIME_F, () -> formatters.secondLong().apply(getUnsafe(NetworkKeys.REFRESH_TIME)));
|
|
||||||
|
|
||||||
putRawData(NetworkKeys.VERSION, version);
|
|
||||||
putSupplier(NetworkKeys.TIME_ZONE, config::getTimeZoneOffsetHours);
|
|
||||||
|
|
||||||
putCachingSupplier(NetworkKeys.NETWORK_NAME, () ->
|
|
||||||
Check.isBungeeAvailable() || Check.isVelocityAvailable() ?
|
|
||||||
config.get(ProxySettings.NETWORK_NAME) :
|
|
||||||
bungeeContainer.getValue(ServerKeys.NAME).orElse("Plan")
|
|
||||||
);
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_ONLINE, serverProperties::getOnlinePlayers);
|
|
||||||
putRawData(NetworkKeys.WORLD_MAP_LOW_COLOR, theme.getValue(ThemeVal.WORLD_MAP_LOW));
|
|
||||||
putRawData(NetworkKeys.WORLD_MAP_HIGH_COLOR, theme.getValue(ThemeVal.WORLD_MAP_HIGH));
|
|
||||||
putRawData(NetworkKeys.PLAYERS_GRAPH_COLOR, theme.getValue(ThemeVal.GRAPH_PLAYERS_ONLINE));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPlayerInformation() {
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_TOTAL, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR).count());
|
|
||||||
putSupplier(NetworkKeys.WORLD_MAP_SERIES, () ->
|
|
||||||
graphs.special().worldMap(database.query(GeoInfoQueries.networkGeolocationCounts())).toHighChartsSeries()
|
|
||||||
);
|
|
||||||
Key<BarGraph> geolocationBarChart = new Key<>(BarGraph.class, "GEOLOCATION_BAR_GRAPH");
|
|
||||||
putSupplier(geolocationBarChart, () -> graphs.bar().geolocationBarGraph(getUnsafe(NetworkKeys.PLAYERS_MUTATOR)));
|
|
||||||
putSupplier(NetworkKeys.COUNTRY_CATEGORIES, () -> getUnsafe(geolocationBarChart).toHighChartsCategories());
|
|
||||||
putSupplier(NetworkKeys.COUNTRY_SERIES, () -> getUnsafe(geolocationBarChart).toHighChartsSeries());
|
|
||||||
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_ONLINE_SERIES, () ->
|
|
||||||
graphs.line().playersOnlineGraph(TPSMutator.forContainer(bungeeContainer)).toHighChartsSeries()
|
|
||||||
);
|
|
||||||
Key<StackGraph> activityStackGraph = new Key<>(StackGraph.class, "ACTIVITY_STACK_GRAPH");
|
|
||||||
putSupplier(NetworkKeys.ACTIVITY_DATA, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR).toActivityDataMap(getUnsafe(NetworkKeys.REFRESH_TIME), config.get(TimeSettings.ACTIVE_PLAY_THRESHOLD)));
|
|
||||||
putSupplier(activityStackGraph, () -> graphs.stack().activityStackGraph(getUnsafe(NetworkKeys.ACTIVITY_DATA)));
|
|
||||||
putSupplier(NetworkKeys.ACTIVITY_STACK_CATEGORIES, () -> getUnsafe(activityStackGraph).toHighChartsLabels());
|
|
||||||
putSupplier(NetworkKeys.ACTIVITY_STACK_SERIES, () -> getUnsafe(activityStackGraph).toHighChartsSeries());
|
|
||||||
putSupplier(NetworkKeys.ACTIVITY_PIE_SERIES, () -> graphs.pie().activityPie_old(
|
|
||||||
getUnsafe(NetworkKeys.ACTIVITY_DATA).get(getUnsafe(NetworkKeys.REFRESH_TIME))).toHighChartsSeries()
|
|
||||||
);
|
|
||||||
|
|
||||||
putSupplier(NetworkKeys.ALL_TIME_PEAK_TIME_F, () ->
|
|
||||||
bungeeContainer.getValue(ServerKeys.ALL_TIME_PEAK_PLAYERS).map(formatters.year()).orElse("No data")
|
|
||||||
);
|
|
||||||
putSupplier(NetworkKeys.RECENT_PEAK_TIME_F, () ->
|
|
||||||
bungeeContainer.getValue(ServerKeys.RECENT_PEAK_PLAYERS).map(formatters.year()).orElse("No data")
|
|
||||||
);
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_ALL_TIME_PEAK, () ->
|
|
||||||
bungeeContainer.getValue(ServerKeys.ALL_TIME_PEAK_PLAYERS).map(dateObj -> "" + dateObj.getValue()).orElse("-")
|
|
||||||
);
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_RECENT_PEAK, () ->
|
|
||||||
bungeeContainer.getValue(ServerKeys.RECENT_PEAK_PLAYERS).map(dateObj -> "" + dateObj.getValue()).orElse("-")
|
|
||||||
);
|
|
||||||
|
|
||||||
addPlayerCounts();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPlayerCounts() {
|
|
||||||
Key<PlayersMutator> newDay = new Key<>(PlayersMutator.class, "NEW_DAY");
|
|
||||||
Key<PlayersMutator> newWeek = new Key<>(PlayersMutator.class, "NEW_WEEK");
|
|
||||||
Key<PlayersMutator> newMonth = new Key<>(PlayersMutator.class, "NEW_MONTH");
|
|
||||||
Key<PlayersMutator> uniqueDay = new Key<>(PlayersMutator.class, "UNIQUE_DAY");
|
|
||||||
Key<PlayersMutator> uniqueWeek = new Key<>(PlayersMutator.class, "UNIQUE_WEEK");
|
|
||||||
Key<PlayersMutator> uniqueMonth = new Key<>(PlayersMutator.class, "UNIQUE_MONTH");
|
|
||||||
putCachingSupplier(newDay, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
|
||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_DAY_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
|
||||||
);
|
|
||||||
putCachingSupplier(newWeek, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
|
||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_WEEK_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
|
||||||
);
|
|
||||||
putCachingSupplier(newMonth, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
|
||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_MONTH_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
|
||||||
);
|
|
||||||
putCachingSupplier(uniqueDay, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
|
||||||
.filterPlayedBetween(getUnsafe(NetworkKeys.REFRESH_TIME_DAY_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
|
||||||
);
|
|
||||||
putCachingSupplier(uniqueWeek, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
|
||||||
.filterPlayedBetween(getUnsafe(NetworkKeys.REFRESH_TIME_WEEK_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
|
||||||
);
|
|
||||||
putCachingSupplier(uniqueMonth, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
|
||||||
.filterPlayedBetween(getUnsafe(NetworkKeys.REFRESH_TIME_MONTH_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
|
||||||
);
|
|
||||||
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_NEW_DAY, () -> getUnsafe(newDay).count());
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_NEW_WEEK, () -> getUnsafe(newWeek).count());
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_NEW_MONTH, () -> getUnsafe(newMonth).count());
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_DAY, () -> getUnsafe(uniqueDay).count());
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_WEEK, () -> getUnsafe(uniqueWeek).count());
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_MONTH, () -> getUnsafe(uniqueMonth).count());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerContainer getBungeeContainer() {
|
|
||||||
return bungeeContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
public static class Factory {
|
|
||||||
|
|
||||||
private final Lazy<String> version;
|
|
||||||
private final Lazy<PlanConfig> config;
|
|
||||||
private final Lazy<Locale> locale;
|
|
||||||
private final Lazy<Theme> theme;
|
|
||||||
private final Lazy<DBSystem> dbSystem;
|
|
||||||
private final Lazy<ServerProperties> serverProperties;
|
|
||||||
private final Lazy<Formatters> formatters;
|
|
||||||
private final Lazy<Graphs> graphs;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public Factory(
|
|
||||||
@Named("currentVersion") Lazy<String> version,
|
|
||||||
Lazy<PlanConfig> config,
|
|
||||||
Lazy<Locale> locale,
|
|
||||||
Lazy<Theme> theme,
|
|
||||||
Lazy<DBSystem> dbSystem,
|
|
||||||
Lazy<ServerProperties> serverProperties,
|
|
||||||
Lazy<Formatters> formatters,
|
|
||||||
Lazy<Graphs> graphs
|
|
||||||
) {
|
|
||||||
this.version = version;
|
|
||||||
this.config = config;
|
|
||||||
this.locale = locale;
|
|
||||||
this.theme = theme;
|
|
||||||
this.dbSystem = dbSystem;
|
|
||||||
this.serverProperties = serverProperties;
|
|
||||||
this.formatters = formatters;
|
|
||||||
this.graphs = graphs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetworkContainer forBungeeContainer(ServerContainer bungeeContainer) {
|
|
||||||
return new NetworkContainer(
|
|
||||||
bungeeContainer,
|
|
||||||
version.get(),
|
|
||||||
config.get(),
|
|
||||||
locale.get(),
|
|
||||||
theme.get(),
|
|
||||||
dbSystem.get(),
|
|
||||||
serverProperties.get(),
|
|
||||||
formatters.get(),
|
|
||||||
graphs.get()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Player Analytics (Plan).
|
|
||||||
*
|
|
||||||
* Plan is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Plan is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.data.store.keys;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.data.container.TPS;
|
|
||||||
import com.djrapitops.plan.data.store.Key;
|
|
||||||
import com.djrapitops.plan.data.store.PlaceholderKey;
|
|
||||||
import com.djrapitops.plan.data.store.Type;
|
|
||||||
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Key objects for {@link com.djrapitops.plan.data.store.containers.NetworkContainer}.
|
|
||||||
*
|
|
||||||
* @author Rsl1122
|
|
||||||
* @see com.djrapitops.plan.data.store.containers.NetworkContainer for DataContainer.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class NetworkKeys {
|
|
||||||
|
|
||||||
public static final PlaceholderKey<String> VERSION = CommonPlaceholderKeys.VERSION;
|
|
||||||
public static final PlaceholderKey<String> NETWORK_NAME = new PlaceholderKey<>(String.class, "networkName");
|
|
||||||
public static final PlaceholderKey<Integer> TIME_ZONE = CommonPlaceholderKeys.TIME_ZONE;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_ONLINE = CommonPlaceholderKeys.PLAYERS_ONLINE;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_TOTAL = CommonPlaceholderKeys.PLAYERS_TOTAL;
|
|
||||||
public static final PlaceholderKey<String> PLAYERS_GRAPH_COLOR = CommonPlaceholderKeys.PLAYERS_GRAPH_COLOR;
|
|
||||||
public static final PlaceholderKey<String> WORLD_MAP_HIGH_COLOR = CommonPlaceholderKeys.WORLD_MAP_HIGH_COLOR;
|
|
||||||
public static final PlaceholderKey<String> WORLD_MAP_LOW_COLOR = CommonPlaceholderKeys.WORLD_MAP_LOW_COLOR;
|
|
||||||
|
|
||||||
public static final PlaceholderKey<String> REFRESH_TIME_F = CommonPlaceholderKeys.REFRESH_TIME_F;
|
|
||||||
public static final PlaceholderKey<String> RECENT_PEAK_TIME_F = CommonPlaceholderKeys.LAST_PEAK_TIME_F;
|
|
||||||
public static final PlaceholderKey<String> ALL_TIME_PEAK_TIME_F = CommonPlaceholderKeys.ALL_TIME_PEAK_TIME_F;
|
|
||||||
public static final PlaceholderKey<String> PLAYERS_RECENT_PEAK = CommonPlaceholderKeys.PLAYERS_LAST_PEAK;
|
|
||||||
public static final PlaceholderKey<String> PLAYERS_ALL_TIME_PEAK = CommonPlaceholderKeys.PLAYERS_ALL_TIME_PEAK;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_DAY = CommonPlaceholderKeys.PLAYERS_DAY;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_WEEK = CommonPlaceholderKeys.PLAYERS_WEEK;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_MONTH = CommonPlaceholderKeys.PLAYERS_MONTH;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_NEW_DAY = CommonPlaceholderKeys.PLAYERS_NEW_DAY;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_NEW_WEEK = CommonPlaceholderKeys.PLAYERS_NEW_WEEK;
|
|
||||||
public static final PlaceholderKey<Integer> PLAYERS_NEW_MONTH = CommonPlaceholderKeys.PLAYERS_NEW_MONTH;
|
|
||||||
|
|
||||||
public static final PlaceholderKey<String> SERVERS_TAB = new PlaceholderKey<>(String.class, "tabContentServers");
|
|
||||||
public static final PlaceholderKey<String> WORLD_MAP_SERIES = CommonPlaceholderKeys.WORLD_MAP_SERIES;
|
|
||||||
public static final PlaceholderKey<String> PLAYERS_ONLINE_SERIES = CommonPlaceholderKeys.PLAYERS_ONLINE_SERIES;
|
|
||||||
public static final PlaceholderKey<String> ACTIVITY_STACK_SERIES = CommonPlaceholderKeys.ACTIVITY_STACK_SERIES;
|
|
||||||
public static final PlaceholderKey<String> ACTIVITY_STACK_CATEGORIES = CommonPlaceholderKeys.ACTIVITY_STACK_CATEGORIES;
|
|
||||||
public static final PlaceholderKey<String> ACTIVITY_PIE_SERIES = CommonPlaceholderKeys.ACTIVITY_PIE_SERIES;
|
|
||||||
public static final PlaceholderKey<String> COUNTRY_CATEGORIES = CommonPlaceholderKeys.COUNTRY_CATEGORIES;
|
|
||||||
public static final PlaceholderKey<String> COUNTRY_SERIES = CommonPlaceholderKeys.COUNTRY_SERIES;
|
|
||||||
public static final PlaceholderKey<Double> HEALTH_INDEX = CommonPlaceholderKeys.HEALTH_INDEX;
|
|
||||||
public static final PlaceholderKey<String> HEALTH_NOTES = CommonPlaceholderKeys.HEALTH_NOTES;
|
|
||||||
|
|
||||||
public static final Key<Long> REFRESH_TIME = new Key<>(Long.class, "REFRESH_TIME");
|
|
||||||
public static final Key<Long> REFRESH_TIME_DAY_AGO = new Key<>(Long.class, "REFRESH_TIME_DAY_AGO");
|
|
||||||
public static final Key<Long> REFRESH_TIME_WEEK_AGO = new Key<>(Long.class, "REFRESH_TIME_WEEK_AGO");
|
|
||||||
public static final Key<Long> REFRESH_TIME_MONTH_AGO = new Key<>(Long.class, "REFRESH_TIME_MONTH_AGO");
|
|
||||||
public static final Key<PlayersMutator> PLAYERS_MUTATOR = CommonKeys.PLAYERS_MUTATOR;
|
|
||||||
|
|
||||||
public static final Key<Collection<Server>> BUKKIT_SERVERS = new Key<>(new Type<Collection<Server>>() {}, "BUKKIT_SERVERS");
|
|
||||||
public static final Key<TreeMap<Long, Map<String, Set<UUID>>>> ACTIVITY_DATA = CommonKeys.ACTIVITY_DATA;
|
|
||||||
public static final Key<Map<Integer, List<TPS>>> NETWORK_PLAYER_ONLINE_DATA = new Key<>(new Type<Map<Integer, List<TPS>>>() {}, "NETWORK_PLAYER_ONLINE_DATA");
|
|
||||||
@Deprecated
|
|
||||||
public static final Key<Map<UUID, Integer>> SERVER_REGISTER_DATA = new Key<>(new Type<Map<UUID, Integer>>() {}, "SERVER_REGISTER_DATA");
|
|
||||||
|
|
||||||
private NetworkKeys() {
|
|
||||||
/* static variable class */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -17,7 +17,6 @@
|
|||||||
package com.djrapitops.plan.db;
|
package com.djrapitops.plan.db;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.db.tasks.KeepAliveTask;
|
import com.djrapitops.plan.db.tasks.KeepAliveTask;
|
||||||
import com.djrapitops.plan.system.file.PlanFiles;
|
import com.djrapitops.plan.system.file.PlanFiles;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
@ -57,12 +56,11 @@ public class H2DB extends SQLDB {
|
|||||||
Locale locale,
|
Locale locale,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
NetworkContainer.Factory networkContainerFactory,
|
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(() -> serverInfo.get().getServerUUID(), locale, config, networkContainerFactory, runnableFactory, logger, errorHandler);
|
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, logger, errorHandler);
|
||||||
dbName = databaseFile.getName();
|
dbName = databaseFile.getName();
|
||||||
this.databaseFile = databaseFile;
|
this.databaseFile = databaseFile;
|
||||||
}
|
}
|
||||||
@ -173,7 +171,6 @@ public class H2DB extends SQLDB {
|
|||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final NetworkContainer.Factory networkContainerFactory;
|
|
||||||
private final RunnableFactory runnableFactory;
|
private final RunnableFactory runnableFactory;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
@ -185,7 +182,6 @@ public class H2DB extends SQLDB {
|
|||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
PlanFiles files,
|
PlanFiles files,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
NetworkContainer.Factory networkContainerFactory,
|
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
@ -194,7 +190,6 @@ public class H2DB extends SQLDB {
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.networkContainerFactory = networkContainerFactory;
|
|
||||||
this.runnableFactory = runnableFactory;
|
this.runnableFactory = runnableFactory;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
@ -211,7 +206,6 @@ public class H2DB extends SQLDB {
|
|||||||
public H2DB usingFile(File databaseFile) {
|
public H2DB usingFile(File databaseFile) {
|
||||||
return new H2DB(databaseFile,
|
return new H2DB(databaseFile,
|
||||||
locale, config, serverInfo,
|
locale, config, serverInfo,
|
||||||
networkContainerFactory,
|
|
||||||
runnableFactory, logger, errorHandler
|
runnableFactory, logger, errorHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ package com.djrapitops.plan.db;
|
|||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
import com.djrapitops.plan.system.locale.Locale;
|
import com.djrapitops.plan.system.locale.Locale;
|
||||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||||
@ -58,13 +57,12 @@ public class MySQLDB extends SQLDB {
|
|||||||
Locale locale,
|
Locale locale,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
NetworkContainer.Factory networkContainerFactory,
|
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PluginLogger pluginLogger,
|
PluginLogger pluginLogger,
|
||||||
Timings timings,
|
Timings timings,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(() -> serverInfo.get().getServerUUID(), locale, config, networkContainerFactory, runnableFactory, pluginLogger, errorHandler);
|
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, pluginLogger, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static synchronized void increment() {
|
private static synchronized void increment() {
|
||||||
|
@ -19,7 +19,6 @@ package com.djrapitops.plan.db;
|
|||||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.FatalDBException;
|
import com.djrapitops.plan.api.exceptions.database.FatalDBException;
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.db.access.Query;
|
import com.djrapitops.plan.db.access.Query;
|
||||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||||
import com.djrapitops.plan.db.access.transactions.init.CreateIndexTransaction;
|
import com.djrapitops.plan.db.access.transactions.init.CreateIndexTransaction;
|
||||||
@ -61,7 +60,6 @@ public abstract class SQLDB extends AbstractDatabase {
|
|||||||
|
|
||||||
protected final Locale locale;
|
protected final Locale locale;
|
||||||
protected final PlanConfig config;
|
protected final PlanConfig config;
|
||||||
protected final NetworkContainer.Factory networkContainerFactory;
|
|
||||||
protected final RunnableFactory runnableFactory;
|
protected final RunnableFactory runnableFactory;
|
||||||
protected final PluginLogger logger;
|
protected final PluginLogger logger;
|
||||||
protected final ErrorHandler errorHandler;
|
protected final ErrorHandler errorHandler;
|
||||||
@ -75,14 +73,13 @@ public abstract class SQLDB extends AbstractDatabase {
|
|||||||
Supplier<UUID> serverUUIDSupplier,
|
Supplier<UUID> serverUUIDSupplier,
|
||||||
Locale locale,
|
Locale locale,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
NetworkContainer.Factory networkContainerFactory, RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
this.serverUUIDSupplier = serverUUIDSupplier;
|
this.serverUUIDSupplier = serverUUIDSupplier;
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.networkContainerFactory = networkContainerFactory;
|
|
||||||
this.runnableFactory = runnableFactory;
|
this.runnableFactory = runnableFactory;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
@ -286,10 +283,6 @@ public abstract class SQLDB extends AbstractDatabase {
|
|||||||
return serverUUIDSupplier;
|
return serverUUIDSupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkContainer.Factory getNetworkContainerFactory() {
|
|
||||||
return networkContainerFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTransactionExecutorServiceProvider(Supplier<ExecutorService> transactionExecutorServiceProvider) {
|
public void setTransactionExecutorServiceProvider(Supplier<ExecutorService> transactionExecutorServiceProvider) {
|
||||||
this.transactionExecutorServiceProvider = transactionExecutorServiceProvider;
|
this.transactionExecutorServiceProvider = transactionExecutorServiceProvider;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
package com.djrapitops.plan.db;
|
package com.djrapitops.plan.db;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.db.tasks.KeepAliveTask;
|
import com.djrapitops.plan.db.tasks.KeepAliveTask;
|
||||||
import com.djrapitops.plan.system.file.PlanFiles;
|
import com.djrapitops.plan.system.file.PlanFiles;
|
||||||
import com.djrapitops.plan.system.info.server.ServerInfo;
|
import com.djrapitops.plan.system.info.server.ServerInfo;
|
||||||
@ -56,12 +55,11 @@ public class SQLiteDB extends SQLDB {
|
|||||||
Locale locale,
|
Locale locale,
|
||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
NetworkContainer.Factory networkContainerFactory,
|
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super(() -> serverInfo.get().getServerUUID(), locale, config, networkContainerFactory, runnableFactory, logger, errorHandler);
|
super(() -> serverInfo.get().getServerUUID(), locale, config, runnableFactory, logger, errorHandler);
|
||||||
dbName = databaseFile.getName();
|
dbName = databaseFile.getName();
|
||||||
this.databaseFile = databaseFile;
|
this.databaseFile = databaseFile;
|
||||||
}
|
}
|
||||||
@ -177,7 +175,6 @@ public class SQLiteDB extends SQLDB {
|
|||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final Lazy<ServerInfo> serverInfo;
|
private final Lazy<ServerInfo> serverInfo;
|
||||||
private final NetworkContainer.Factory networkContainerFactory;
|
|
||||||
private final RunnableFactory runnableFactory;
|
private final RunnableFactory runnableFactory;
|
||||||
private final PluginLogger logger;
|
private final PluginLogger logger;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
@ -189,7 +186,6 @@ public class SQLiteDB extends SQLDB {
|
|||||||
PlanConfig config,
|
PlanConfig config,
|
||||||
PlanFiles files,
|
PlanFiles files,
|
||||||
Lazy<ServerInfo> serverInfo,
|
Lazy<ServerInfo> serverInfo,
|
||||||
NetworkContainer.Factory networkContainerFactory,
|
|
||||||
RunnableFactory runnableFactory,
|
RunnableFactory runnableFactory,
|
||||||
PluginLogger logger,
|
PluginLogger logger,
|
||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
@ -198,7 +194,6 @@ public class SQLiteDB extends SQLDB {
|
|||||||
this.config = config;
|
this.config = config;
|
||||||
this.files = files;
|
this.files = files;
|
||||||
this.serverInfo = serverInfo;
|
this.serverInfo = serverInfo;
|
||||||
this.networkContainerFactory = networkContainerFactory;
|
|
||||||
this.runnableFactory = runnableFactory;
|
this.runnableFactory = runnableFactory;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
@ -215,7 +210,6 @@ public class SQLiteDB extends SQLDB {
|
|||||||
public SQLiteDB usingFile(File databaseFile) {
|
public SQLiteDB usingFile(File databaseFile) {
|
||||||
return new SQLiteDB(databaseFile,
|
return new SQLiteDB(databaseFile,
|
||||||
locale, config, serverInfo,
|
locale, config, serverInfo,
|
||||||
networkContainerFactory,
|
|
||||||
runnableFactory, logger, errorHandler
|
runnableFactory, logger, errorHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.db.access.queries.containers;
|
package com.djrapitops.plan.db.access.queries.containers;
|
||||||
|
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||||
import com.djrapitops.plan.db.access.Query;
|
import com.djrapitops.plan.db.access.Query;
|
||||||
@ -35,16 +34,6 @@ public class ContainerFetchQueries {
|
|||||||
/* Static method class */
|
/* Static method class */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to get a NetworkContainer, some limitations apply to values returned by DataContainer keys.
|
|
||||||
*
|
|
||||||
* @return a new NetworkContainer.
|
|
||||||
* @see NetworkContainerQuery
|
|
||||||
*/
|
|
||||||
public static Query<NetworkContainer> fetchNetworkContainer() {
|
|
||||||
return new NetworkContainerQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to get a ServerContainer, some limitations apply to values returned by DataContainer keys.
|
* Used to get a ServerContainer, some limitations apply to values returned by DataContainer keys.
|
||||||
*
|
*
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Player Analytics (Plan).
|
|
||||||
*
|
|
||||||
* Plan is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Plan is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.db.access.queries.containers;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
|
||||||
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
|
||||||
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;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to get a NetworkContainer, some limitations apply to values returned by DataContainer keys.
|
|
||||||
* <p>
|
|
||||||
* Limitations:
|
|
||||||
* - Bungee ServerContainer does not support: ServerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_DEATHS, PLAYER_KILL_COUNT
|
|
||||||
* - Bungee ServerContainer ServerKeys.TPS only contains playersOnline values
|
|
||||||
* - NetworkKeys.PLAYERS PlayerContainers:
|
|
||||||
* - do not support: PlayerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_DEATHS, PLAYER_KILL_COUNT
|
|
||||||
* - PlayerKeys.PER_SERVER does not support: PerServerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_DEATHS, PLAYER_KILL_COUNT
|
|
||||||
* <p>
|
|
||||||
* Blocking methods are not called until DataContainer getter methods are called.
|
|
||||||
*
|
|
||||||
* @author Rsl1122
|
|
||||||
*/
|
|
||||||
public class NetworkContainerQuery implements Query<NetworkContainer> {
|
|
||||||
|
|
||||||
private static Query<ServerContainer> getProxyServerContainer() {
|
|
||||||
return db -> {
|
|
||||||
Optional<Server> proxyInformation = db.query(ServerQueries.fetchProxyServerInformation());
|
|
||||||
if (!proxyInformation.isPresent()) {
|
|
||||||
return new ServerContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
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.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);
|
|
||||||
|
|
||||||
return container;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NetworkContainer executeQuery(SQLDB db) {
|
|
||||||
ServerContainer bungeeContainer = db.query(getProxyServerContainer());
|
|
||||||
NetworkContainer networkContainer = db.getNetworkContainerFactory().forBungeeContainer(bungeeContainer);
|
|
||||||
networkContainer.putCachingSupplier(NetworkKeys.BUKKIT_SERVERS, () ->
|
|
||||||
db.query(ServerQueries.fetchPlanServerInformation()).values()
|
|
||||||
.stream().filter(Server::isNotProxy).collect(Collectors.toSet())
|
|
||||||
);
|
|
||||||
return networkContainer;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,243 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Player Analytics (Plan).
|
|
||||||
*
|
|
||||||
* Plan is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Plan is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.system.database.databases.operation;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.data.WebUser;
|
|
||||||
import com.djrapitops.plan.data.container.GeoInfo;
|
|
||||||
import com.djrapitops.plan.data.container.Session;
|
|
||||||
import com.djrapitops.plan.data.container.TPS;
|
|
||||||
import com.djrapitops.plan.data.container.UserInfo;
|
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
|
||||||
import com.djrapitops.plan.system.settings.config.Config;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public interface FetchOperations {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to get a NetworkContainer, some limitations apply to values returned by DataContainer keys.
|
|
||||||
* <p>
|
|
||||||
* Limitations:
|
|
||||||
* - Bungee ServerContainer does not support: ServerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_DEATHS, PLAYER_KILL_COUNT
|
|
||||||
* - Bungee ServerContainer ServerKeys.TPS only contains playersOnline values
|
|
||||||
* - NetworkKeys.PLAYERS PlayerContainers:
|
|
||||||
* - do not support: PlayerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_DEATHS, PLAYER_KILL_COUNT
|
|
||||||
* - PlayerKeys.PER_SERVER does not support: PerServerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_DEATHS, PLAYER_KILL_COUNT
|
|
||||||
* <p>
|
|
||||||
* Blocking methods are not called until DataContainer getter methods are called.
|
|
||||||
*
|
|
||||||
* @return a new NetworkContainer.
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.queries.containers.NetworkContainerQuery}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
NetworkContainer getNetworkContainer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to get a ServerContainer, some limitations apply to values returned by DataContainer keys.
|
|
||||||
* <p>
|
|
||||||
* Limitations:
|
|
||||||
* - ServerKeys.PLAYERS PlayerContainers PlayerKeys.PER_SERVER only contains information about the queried server.
|
|
||||||
* <p>
|
|
||||||
* Blocking methods are not called until DataContainer getter methods are called.
|
|
||||||
*
|
|
||||||
* @param serverUUID UUID of the Server.
|
|
||||||
* @return a new ServerContainer.
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.queries.containers.ServerContainerQuery}.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
ServerContainer getServerContainer(UUID serverUUID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to get PlayerContainers of all players on the network, some limitations apply to DataContainer keys.
|
|
||||||
* <p>
|
|
||||||
* Limitations:
|
|
||||||
* - PlayerContainers do not support: PlayerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_KILL_COUNT
|
|
||||||
* - PlayerContainers PlayerKeys.PER_SERVER does not support: PerServerKeys WORLD_TIMES, PLAYER_KILLS, PLAYER_KILL_COUNT
|
|
||||||
* <p>
|
|
||||||
* Blocking methods are not called until DataContainer getter methods are called.
|
|
||||||
*
|
|
||||||
* @return a list of PlayerContainers in Plan database.
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.queries.containers.AllPlayerContainersQuery}.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<PlayerContainer> getAllPlayerContainers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to get a PlayerContainer of a specific player.
|
|
||||||
* <p>
|
|
||||||
* Blocking methods are not called until DataContainer getter methods are called.
|
|
||||||
*
|
|
||||||
* @param uuid UUID of the player.
|
|
||||||
* @return a new PlayerContainer.
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.queries.containers.PlayerContainerQuery}.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
PlayerContainer getPlayerContainer(UUID uuid);
|
|
||||||
|
|
||||||
// UUIDs
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Set<UUID> getSavedUUIDs();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Set<UUID> getSavedUUIDs(UUID server);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, String> getServerNames();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Optional<UUID> getServerUUID(String serverName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
UUID getUuidOf(String playerName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
WebUser getWebUser(String username);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Optional<String> getServerName(UUID serverUUID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Optional<Server> getBungeeInformation();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Optional<Integer> getServerID(UUID serverUUID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<TPS> getTPSData(UUID serverUUID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, Map<UUID, List<Session>>> getSessionsWithNoExtras();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated It was not possible to keep this compatible so now empty map is returned.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, UserInfo> getUsers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Now empty map is returned.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, Long> getLastSeenForAllPlayers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, List<GeoInfo>> getAllGeoInfo();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, String> getPlayerNames();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
String getPlayerName(UUID playerUUID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<String> getNicknames(UUID uuid);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, Server> getBukkitServers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<WebUser> getWebUsers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<Server> getServers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
List<UUID> getServerUUIDs();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<Integer, List<TPS>> getPlayersOnlineForServers(Collection<Server> servers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Map<UUID, Integer> getPlayersRegisteredForServers(Collection<Server> servers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
Optional<Config> getNewConfig(long updatedAfter, UUID serverUUID);
|
|
||||||
}
|
|
@ -1,196 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Player Analytics (Plan).
|
|
||||||
*
|
|
||||||
* Plan is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Plan is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.djrapitops.plan.system.database.databases.sql.operation;
|
|
||||||
|
|
||||||
import com.djrapitops.plan.data.WebUser;
|
|
||||||
import com.djrapitops.plan.data.container.GeoInfo;
|
|
||||||
import com.djrapitops.plan.data.container.Session;
|
|
||||||
import com.djrapitops.plan.data.container.TPS;
|
|
||||||
import com.djrapitops.plan.data.container.UserInfo;
|
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
|
||||||
import com.djrapitops.plan.data.store.objects.Nickname;
|
|
||||||
import com.djrapitops.plan.db.Database;
|
|
||||||
import com.djrapitops.plan.db.access.queries.ServerAggregateQueries;
|
|
||||||
import com.djrapitops.plan.db.access.queries.containers.ContainerFetchQueries;
|
|
||||||
import com.djrapitops.plan.db.access.queries.objects.*;
|
|
||||||
import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
|
|
||||||
import com.djrapitops.plan.system.info.server.Server;
|
|
||||||
import com.djrapitops.plan.system.settings.config.Config;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Bad API, replaced with {@link com.djrapitops.plan.db.access.Query} objects.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class SQLFetchOps implements FetchOperations {
|
|
||||||
|
|
||||||
private final Database db;
|
|
||||||
|
|
||||||
public SQLFetchOps(Database db) {
|
|
||||||
this.db = db;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NetworkContainer getNetworkContainer() {
|
|
||||||
return db.query(ContainerFetchQueries.fetchNetworkContainer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServerContainer getServerContainer(UUID serverUUID) {
|
|
||||||
return db.query(ContainerFetchQueries.fetchServerContainer(serverUUID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<PlayerContainer> getAllPlayerContainers() {
|
|
||||||
return db.query(ContainerFetchQueries.fetchAllPlayerContainers());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlayerContainer getPlayerContainer(UUID uuid) {
|
|
||||||
return db.query(ContainerFetchQueries.fetchPlayerContainer(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<UUID> getSavedUUIDs() {
|
|
||||||
return db.query(UserIdentifierQueries.fetchAllPlayerUUIDs());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<UUID> getSavedUUIDs(UUID serverUUID) {
|
|
||||||
return db.query(UserIdentifierQueries.fetchPlayerUUIDsOfServer(serverUUID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, String> getServerNames() {
|
|
||||||
return db.query(ServerQueries.fetchServerNames());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<UUID> getServerUUID(String serverName) {
|
|
||||||
return db.query(ServerQueries.fetchServerMatchingIdentifier(serverName))
|
|
||||||
.map(Server::getUuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUuidOf(String playerName) {
|
|
||||||
return db.query(UserIdentifierQueries.fetchPlayerUUIDOf(playerName)).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WebUser getWebUser(String username) {
|
|
||||||
return db.query(WebUserQueries.fetchWebUser(username)).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<TPS> getTPSData(UUID serverUUID) {
|
|
||||||
return db.query(TPSQueries.fetchTPSDataOfServer(serverUUID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, Map<UUID, List<Session>>> getSessionsWithNoExtras() {
|
|
||||||
return db.query(SessionQueries.fetchAllSessionsWithoutKillOrWorldData());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, UserInfo> getUsers() {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, Long> getLastSeenForAllPlayers() {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, List<GeoInfo>> getAllGeoInfo() {
|
|
||||||
return db.query(GeoInfoQueries.fetchAllGeoInformation());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, String> getPlayerNames() {
|
|
||||||
return db.query(UserIdentifierQueries.fetchAllPlayerNames());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPlayerName(UUID playerUUID) {
|
|
||||||
return db.query(UserIdentifierQueries.fetchPlayerNameOf(playerUUID)).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<String> getServerName(UUID serverUUID) {
|
|
||||||
return db.query(ServerQueries.fetchServerMatchingIdentifier(serverUUID)).map(Server::getName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getNicknames(UUID playerUUID) {
|
|
||||||
return db.query(NicknameQueries.fetchNicknameDataOfPlayer(playerUUID)).stream()
|
|
||||||
.map(Nickname::getName).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Server> getBungeeInformation() {
|
|
||||||
return db.query(ServerQueries.fetchProxyServerInformation());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Integer> getServerID(UUID serverUUID) {
|
|
||||||
return db.query(ServerQueries.fetchServerMatchingIdentifier(serverUUID)).map(Server::getId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, Server> getBukkitServers() {
|
|
||||||
return db.query(ServerQueries.fetchPlanServerInformation()).entrySet().stream()
|
|
||||||
.filter(entry -> entry.getValue().isNotProxy())
|
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<WebUser> getWebUsers() {
|
|
||||||
return new ArrayList<>(db.query(WebUserQueries.fetchAllPlanWebUsers()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Server> getServers() {
|
|
||||||
List<Server> servers = new ArrayList<>(db.query(ServerQueries.fetchPlanServerInformation()).values());
|
|
||||||
Collections.sort(servers);
|
|
||||||
return servers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<UUID> getServerUUIDs() {
|
|
||||||
return new ArrayList<>(db.query(ServerQueries.fetchPlanServerInformation()).keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, List<TPS>> getPlayersOnlineForServers(Collection<Server> servers) {
|
|
||||||
return db.query(TPSQueries.fetchPlayerOnlineDataOfServers(servers));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<UUID, Integer> getPlayersRegisteredForServers(Collection<Server> servers) {
|
|
||||||
return db.query(ServerAggregateQueries.serverUserCounts());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<Config> getNewConfig(long updatedAfter, UUID serverUUID) {
|
|
||||||
return db.query(new NewerConfigQuery(serverUUID, updatedAfter));
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,6 @@
|
|||||||
package com.djrapitops.plan.utilities.html.pages;
|
package com.djrapitops.plan.utilities.html.pages;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.connection.NotFoundException;
|
import com.djrapitops.plan.api.exceptions.connection.NotFoundException;
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||||
import com.djrapitops.plan.db.Database;
|
import com.djrapitops.plan.db.Database;
|
||||||
import com.djrapitops.plan.db.access.queries.containers.ContainerFetchQueries;
|
import com.djrapitops.plan.db.access.queries.containers.ContainerFetchQueries;
|
||||||
@ -160,8 +159,6 @@ public class PageFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public NetworkPage networkPage() {
|
public NetworkPage networkPage() {
|
||||||
NetworkContainer networkContainer = dbSystem.get().getDatabase()
|
|
||||||
.query(ContainerFetchQueries.fetchNetworkContainer()); // Not cached, big.
|
|
||||||
return new NetworkPage(dbSystem.get(),
|
return new NetworkPage(dbSystem.get(),
|
||||||
versionCheckSystem.get(), fileSystem.get(), config.get(), theme.get(), serverInfo.get(), formatters.get());
|
versionCheckSystem.get(), fileSystem.get(), config.get(), theme.get(), serverInfo.get(), formatters.get());
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,8 @@ import com.djrapitops.plan.data.WebUser;
|
|||||||
import com.djrapitops.plan.data.container.*;
|
import com.djrapitops.plan.data.container.*;
|
||||||
import com.djrapitops.plan.data.element.TableContainer;
|
import com.djrapitops.plan.data.element.TableContainer;
|
||||||
import com.djrapitops.plan.data.store.Key;
|
import com.djrapitops.plan.data.store.Key;
|
||||||
import com.djrapitops.plan.data.store.containers.NetworkContainer;
|
|
||||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||||
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
import com.djrapitops.plan.data.store.containers.ServerContainer;
|
||||||
import com.djrapitops.plan.data.store.keys.NetworkKeys;
|
|
||||||
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
||||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
||||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||||
@ -930,22 +928,6 @@ public interface DatabaseTest {
|
|||||||
assertTrue(unsupported.isEmpty(), () -> "Some keys are not supported by ServerContainer: ServerKeys." + unsupported.toString());
|
assertTrue(unsupported.isEmpty(), () -> "Some keys are not supported by ServerContainer: ServerKeys." + unsupported.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
default void networkContainerSupportsAllNetworkKeys() throws IllegalAccessException, NoSuchAlgorithmException {
|
|
||||||
serverContainerSupportsAllServerKeys();
|
|
||||||
NetworkContainer networkContainer = db().query(ContainerFetchQueries.fetchNetworkContainer());
|
|
||||||
|
|
||||||
List<String> unsupported = new ArrayList<>();
|
|
||||||
List<Key> keys = FieldFetcher.getPublicStaticFields(NetworkKeys.class, Key.class);
|
|
||||||
for (Key key : keys) {
|
|
||||||
if (!networkContainer.supports(key)) {
|
|
||||||
unsupported.add(key.getKeyName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertTrue(unsupported.isEmpty(), () -> "Some keys are not supported by NetworkContainer: NetworkKeys." + unsupported.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
default void testGetMatchingNames() {
|
default void testGetMatchingNames() {
|
||||||
String exp1 = "TestName";
|
String exp1 = "TestName";
|
||||||
|
Loading…
Reference in New Issue
Block a user