mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-13 11:41:34 +01:00
Fixed a few mistakes
This commit is contained in:
parent
6830a0ed9f
commit
599a688545
@ -15,6 +15,7 @@ import com.djrapitops.plan.system.settings.theme.ThemeVal;
|
|||||||
import com.djrapitops.plan.utilities.MiscUtils;
|
import com.djrapitops.plan.utilities.MiscUtils;
|
||||||
import com.djrapitops.plan.utilities.html.graphs.WorldMap;
|
import com.djrapitops.plan.utilities.html.graphs.WorldMap;
|
||||||
import com.djrapitops.plan.utilities.html.graphs.line.OnlineActivityGraph;
|
import com.djrapitops.plan.utilities.html.graphs.line.OnlineActivityGraph;
|
||||||
|
import com.djrapitops.plugin.api.TimeAmount;
|
||||||
import com.djrapitops.plugin.api.utility.log.Log;
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -67,6 +68,9 @@ public class NetworkContainer extends DataContainer {
|
|||||||
private void addConstants() {
|
private void addConstants() {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
putRawData(NetworkKeys.REFRESH_TIME, now);
|
putRawData(NetworkKeys.REFRESH_TIME, now);
|
||||||
|
putRawData(NetworkKeys.REFRESH_TIME_DAY_AGO, getUnsafe(NetworkKeys.REFRESH_TIME) - TimeAmount.DAY.ms());
|
||||||
|
putRawData(NetworkKeys.REFRESH_TIME_WEEK_AGO, getUnsafe(NetworkKeys.REFRESH_TIME) - TimeAmount.WEEK.ms());
|
||||||
|
putRawData(NetworkKeys.REFRESH_TIME_MONTH_AGO, getUnsafe(NetworkKeys.REFRESH_TIME) - TimeAmount.MONTH.ms());
|
||||||
putSupplier(NetworkKeys.REFRESH_TIME_F, () -> Formatters.second().apply(() -> getUnsafe(NetworkKeys.REFRESH_TIME)));
|
putSupplier(NetworkKeys.REFRESH_TIME_F, () -> Formatters.second().apply(() -> getUnsafe(NetworkKeys.REFRESH_TIME)));
|
||||||
|
|
||||||
putRawData(NetworkKeys.VERSION, PlanPlugin.getInstance().getVersion());
|
putRawData(NetworkKeys.VERSION, PlanPlugin.getInstance().getVersion());
|
||||||
@ -80,7 +84,7 @@ public class NetworkContainer extends DataContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addPlayerInformation() {
|
private void addPlayerInformation() {
|
||||||
putSupplier(NetworkKeys.PLAYERS_TOTAL, () -> bungeeContainer.getValue(ServerKeys.PLAYER_COUNT).orElse(-1));
|
putSupplier(NetworkKeys.PLAYERS_TOTAL, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR).count());
|
||||||
putSupplier(NetworkKeys.WORLD_MAP_SERIES, () ->
|
putSupplier(NetworkKeys.WORLD_MAP_SERIES, () ->
|
||||||
new WorldMap(PlayersMutator.forContainer(bungeeContainer)).toHighChartsSeries()
|
new WorldMap(PlayersMutator.forContainer(bungeeContainer)).toHighChartsSeries()
|
||||||
);
|
);
|
||||||
@ -120,13 +124,13 @@ public class NetworkContainer extends DataContainer {
|
|||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_MONTH_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_MONTH_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
||||||
);
|
);
|
||||||
putSupplier(uniqueDay, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
putSupplier(uniqueDay, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_DAY_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
.filterPlayedBetween(getUnsafe(NetworkKeys.REFRESH_TIME_DAY_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
||||||
);
|
);
|
||||||
putSupplier(uniqueWeek, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
putSupplier(uniqueWeek, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_WEEK_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
.filterPlayedBetween(getUnsafe(NetworkKeys.REFRESH_TIME_WEEK_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
||||||
);
|
);
|
||||||
putSupplier(uniqueMonth, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
putSupplier(uniqueMonth, () -> getUnsafe(NetworkKeys.PLAYERS_MUTATOR)
|
||||||
.filterRegisteredBetween(getUnsafe(NetworkKeys.REFRESH_TIME_MONTH_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
.filterPlayedBetween(getUnsafe(NetworkKeys.REFRESH_TIME_MONTH_AGO), getUnsafe(NetworkKeys.REFRESH_TIME))
|
||||||
);
|
);
|
||||||
|
|
||||||
putSupplier(NetworkKeys.PLAYERS_NEW_DAY, () -> getUnsafe(newDay).count());
|
putSupplier(NetworkKeys.PLAYERS_NEW_DAY, () -> getUnsafe(newDay).count());
|
||||||
|
@ -29,6 +29,7 @@ public class PerServerDataMutator {
|
|||||||
|
|
||||||
public List<Session> flatMapSessions() {
|
public List<Session> flatMapSessions() {
|
||||||
return data.values().stream()
|
return data.values().stream()
|
||||||
|
.filter(container -> container.supports(PerServerKeys.SESSIONS))
|
||||||
.map(container -> container.getUnsafe(PerServerKeys.SESSIONS))
|
.map(container -> container.getUnsafe(PerServerKeys.SESSIONS))
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@ -38,8 +39,10 @@ public class PerServerDataMutator {
|
|||||||
WorldTimes total = new WorldTimes(new HashMap<>());
|
WorldTimes total = new WorldTimes(new HashMap<>());
|
||||||
|
|
||||||
for (DataContainer container : data.values()) {
|
for (DataContainer container : data.values()) {
|
||||||
WorldTimes worldTimes = container.getUnsafe(PerServerKeys.WORLD_TIMES);
|
if (container.supports(PerServerKeys.WORLD_TIMES)) {
|
||||||
total.add(worldTimes);
|
WorldTimes worldTimes = container.getUnsafe(PerServerKeys.WORLD_TIMES);
|
||||||
|
total.add(worldTimes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
@ -48,7 +51,8 @@ public class PerServerDataMutator {
|
|||||||
public Map<UUID, WorldTimes> worldTimesPerServer() {
|
public Map<UUID, WorldTimes> worldTimesPerServer() {
|
||||||
Map<UUID, WorldTimes> timesMap = new HashMap<>();
|
Map<UUID, WorldTimes> timesMap = new HashMap<>();
|
||||||
for (Map.Entry<UUID, DataContainer> entry : data.entrySet()) {
|
for (Map.Entry<UUID, DataContainer> entry : data.entrySet()) {
|
||||||
timesMap.put(entry.getKey(), entry.getValue().getUnsafe(PerServerKeys.WORLD_TIMES));
|
DataContainer container = entry.getValue();
|
||||||
|
timesMap.put(entry.getKey(), container.getValue(PerServerKeys.WORLD_TIMES).orElse(new WorldTimes(new HashMap<>())));
|
||||||
}
|
}
|
||||||
return timesMap;
|
return timesMap;
|
||||||
}
|
}
|
||||||
@ -71,14 +75,14 @@ public class PerServerDataMutator {
|
|||||||
public Map<UUID, List<Session>> sessionsPerServer() {
|
public Map<UUID, List<Session>> sessionsPerServer() {
|
||||||
Map<UUID, List<Session>> sessionMap = new HashMap<>();
|
Map<UUID, List<Session>> sessionMap = new HashMap<>();
|
||||||
for (Map.Entry<UUID, DataContainer> entry : data.entrySet()) {
|
for (Map.Entry<UUID, DataContainer> entry : data.entrySet()) {
|
||||||
sessionMap.put(entry.getKey(), entry.getValue().getUnsafe(PerServerKeys.SESSIONS));
|
sessionMap.put(entry.getKey(), entry.getValue().getValue(PerServerKeys.SESSIONS).orElse(new ArrayList<>()));
|
||||||
}
|
}
|
||||||
return sessionMap;
|
return sessionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBanned() {
|
public boolean isBanned() {
|
||||||
for (DataContainer container : data.values()) {
|
for (DataContainer container : data.values()) {
|
||||||
if (container.getUnsafe(PlayerKeys.BANNED)) {
|
if (container.getValue(PlayerKeys.BANNED).orElse(false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +91,7 @@ public class PerServerDataMutator {
|
|||||||
|
|
||||||
public boolean isOperator() {
|
public boolean isOperator() {
|
||||||
for (DataContainer container : data.values()) {
|
for (DataContainer container : data.values()) {
|
||||||
if (container.getUnsafe(PlayerKeys.OPERATOR)) {
|
if (container.getValue(PlayerKeys.OPERATOR).orElse(false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import com.djrapitops.plan.data.store.keys.SessionKeys;
|
|||||||
import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
|
import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
|
||||||
import com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
import com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||||
import com.djrapitops.plugin.api.TimeAmount;
|
import com.djrapitops.plugin.api.TimeAmount;
|
||||||
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -33,6 +34,9 @@ public class PlayersMutator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static PlayersMutator forContainer(DataContainer container) {
|
public static PlayersMutator forContainer(DataContainer container) {
|
||||||
|
if (!container.supports(ServerKeys.PLAYERS)) {
|
||||||
|
Log.warn(container.getClass().getSimpleName() + " does not support PLAYERS key.");
|
||||||
|
}
|
||||||
return new PlayersMutator(container.getValue(ServerKeys.PLAYERS).orElse(new ArrayList<>()));
|
return new PlayersMutator(container.getValue(ServerKeys.PLAYERS).orElse(new ArrayList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import com.djrapitops.plan.data.store.keys.CommonKeys;
|
|||||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||||
import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
|
import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
|
||||||
import com.djrapitops.plan.data.time.WorldTimes;
|
import com.djrapitops.plan.data.time.WorldTimes;
|
||||||
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@ -24,8 +25,11 @@ public class SessionsMutator {
|
|||||||
|
|
||||||
private List<Session> sessions;
|
private List<Session> sessions;
|
||||||
|
|
||||||
public static SessionsMutator forContainer(DataContainer dataContainer) {
|
public static SessionsMutator forContainer(DataContainer container) {
|
||||||
return new SessionsMutator(dataContainer.getValue(CommonKeys.SESSIONS).orElse(new ArrayList<>()));
|
if (!container.supports(CommonKeys.SESSIONS)) {
|
||||||
|
Log.warn(container.getClass().getSimpleName() + " does not support SESSIONS key.");
|
||||||
|
}
|
||||||
|
return new SessionsMutator(container.getValue(CommonKeys.SESSIONS).orElse(new ArrayList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SessionsMutator copyOf(SessionsMutator mutator) {
|
public static SessionsMutator copyOf(SessionsMutator mutator) {
|
||||||
|
@ -4,9 +4,9 @@ import com.djrapitops.plan.data.container.TPS;
|
|||||||
import com.djrapitops.plan.data.store.containers.DataContainer;
|
import com.djrapitops.plan.data.store.containers.DataContainer;
|
||||||
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
import com.djrapitops.plan.data.store.keys.ServerKeys;
|
||||||
import com.djrapitops.plan.system.settings.Settings;
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import com.djrapitops.plan.utilities.FormatUtils;
|
|
||||||
import com.djrapitops.plan.utilities.html.graphs.line.Point;
|
import com.djrapitops.plan.utilities.html.graphs.line.Point;
|
||||||
import com.djrapitops.plugin.api.TimeAmount;
|
import com.djrapitops.plugin.api.TimeAmount;
|
||||||
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,8 +28,11 @@ public class TPSMutator {
|
|||||||
this.tpsData = tpsData;
|
this.tpsData = tpsData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TPSMutator forContainer(DataContainer dataContainer) {
|
public static TPSMutator forContainer(DataContainer container) {
|
||||||
return new TPSMutator(dataContainer.getValue(ServerKeys.TPS).orElse(new ArrayList<>()));
|
if (!container.supports(ServerKeys.TPS)) {
|
||||||
|
Log.warn(container.getClass().getSimpleName() + " does not support TPS key.");
|
||||||
|
}
|
||||||
|
return new TPSMutator(container.getValue(ServerKeys.TPS).orElse(new ArrayList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TPSMutator copyOf(TPSMutator mutator) {
|
public static TPSMutator copyOf(TPSMutator mutator) {
|
||||||
@ -171,7 +174,7 @@ public class TPSMutator {
|
|||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average();
|
||||||
if (average.isPresent()) {
|
if (average.isPresent()) {
|
||||||
return Double.parseDouble(FormatUtils.cutDecimals(average.getAsDouble()));
|
return average.getAsDouble();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -182,7 +185,7 @@ public class TPSMutator {
|
|||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average();
|
||||||
if (average.isPresent()) {
|
if (average.isPresent()) {
|
||||||
return Double.parseDouble(FormatUtils.cutDecimals(average.getAsDouble()));
|
return average.getAsDouble();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -193,7 +196,7 @@ public class TPSMutator {
|
|||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average();
|
||||||
if (average.isPresent()) {
|
if (average.isPresent()) {
|
||||||
return Double.parseDouble(FormatUtils.cutDecimals(average.getAsDouble()));
|
return average.getAsDouble();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -204,7 +207,7 @@ public class TPSMutator {
|
|||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average();
|
||||||
if (average.isPresent()) {
|
if (average.isPresent()) {
|
||||||
return Double.parseDouble(FormatUtils.cutDecimals(average.getAsDouble()));
|
return average.getAsDouble();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -215,7 +218,7 @@ public class TPSMutator {
|
|||||||
.filter(num -> num >= 0)
|
.filter(num -> num >= 0)
|
||||||
.average();
|
.average();
|
||||||
if (average.isPresent()) {
|
if (average.isPresent()) {
|
||||||
return Double.parseDouble(FormatUtils.cutDecimals(average.getAsDouble()));
|
return average.getAsDouble();
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.djrapitops.plan.data.store.containers.*;
|
|||||||
import com.djrapitops.plan.data.store.keys.PerServerKeys;
|
import com.djrapitops.plan.data.store.keys.PerServerKeys;
|
||||||
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.mutators.PerServerDataMutator;
|
import com.djrapitops.plan.data.store.mutators.PerServerDataMutator;
|
||||||
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
import com.djrapitops.plan.data.store.mutators.PlayersMutator;
|
||||||
import com.djrapitops.plan.data.store.mutators.SessionsMutator;
|
import com.djrapitops.plan.data.store.mutators.SessionsMutator;
|
||||||
@ -60,7 +61,7 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
container.putRawData(ServerKeys.SERVER_UUID, serverUUID);
|
container.putRawData(ServerKeys.SERVER_UUID, serverUUID);
|
||||||
container.putRawData(ServerKeys.NAME, serverInfo.get().getName());
|
container.putRawData(ServerKeys.NAME, serverInfo.get().getName());
|
||||||
container.putSupplier(ServerKeys.PLAYERS, () -> getPlayerContainers(serverUUID));
|
container.putSupplier(ServerKeys.PLAYERS, () -> getPlayerContainers(serverUUID));
|
||||||
container.putSupplier(ServerKeys.PLAYER_COUNT, container.getUnsafe(ServerKeys.PLAYERS)::size);
|
container.putSupplier(ServerKeys.PLAYER_COUNT, () -> container.getUnsafe(ServerKeys.PLAYERS).size());
|
||||||
|
|
||||||
container.putSupplier(ServerKeys.TPS, () -> tpsTable.getTPSData(serverUUID));
|
container.putSupplier(ServerKeys.TPS, () -> tpsTable.getTPSData(serverUUID));
|
||||||
container.putSupplier(ServerKeys.ALL_TIME_PEAK_PLAYERS, () -> {
|
container.putSupplier(ServerKeys.ALL_TIME_PEAK_PLAYERS, () -> {
|
||||||
@ -87,10 +88,10 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
// Calculating getters
|
// Calculating getters
|
||||||
container.putSupplier(ServerKeys.OPERATORS, () -> PlayersMutator.forContainer(container).operators());
|
container.putSupplier(ServerKeys.OPERATORS, () -> PlayersMutator.forContainer(container).operators());
|
||||||
container.putSupplier(ServerKeys.SESSIONS, () -> PlayersMutator.forContainer(container).getSessions());
|
container.putSupplier(ServerKeys.SESSIONS, () -> PlayersMutator.forContainer(container).getSessions());
|
||||||
container.putSupplier(ServerKeys.PLAYER_KILLS, SessionsMutator.forContainer(container)::toPlayerKillList);
|
container.putSupplier(ServerKeys.PLAYER_KILLS, () -> SessionsMutator.forContainer(container).toPlayerKillList());
|
||||||
container.putSupplier(ServerKeys.PLAYER_KILL_COUNT, container.getUnsafe(ServerKeys.PLAYER_KILLS)::size);
|
container.putSupplier(ServerKeys.PLAYER_KILL_COUNT, () -> container.getUnsafe(ServerKeys.PLAYER_KILLS).size());
|
||||||
container.putSupplier(ServerKeys.MOB_KILL_COUNT, SessionsMutator.forContainer(container)::toMobKillCount);
|
container.putSupplier(ServerKeys.MOB_KILL_COUNT, () -> SessionsMutator.forContainer(container).toMobKillCount());
|
||||||
container.putSupplier(ServerKeys.DEATH_COUNT, SessionsMutator.forContainer(container)::toDeathCount);
|
container.putSupplier(ServerKeys.DEATH_COUNT, () -> SessionsMutator.forContainer(container).toDeathCount());
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
@ -137,20 +138,22 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
// Calculating getters
|
// Calculating getters
|
||||||
container.putSupplier(PlayerKeys.WORLD_TIMES, () -> {
|
container.putSupplier(PlayerKeys.WORLD_TIMES, () -> {
|
||||||
WorldTimes worldTimes = new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).flatMapWorldTimes();
|
WorldTimes worldTimes = new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).flatMapWorldTimes();
|
||||||
container.getValue(PlayerKeys.ACTIVE_SESSION).ifPresent(session -> worldTimes.add(session.getWorldTimes()));
|
container.getValue(PlayerKeys.ACTIVE_SESSION)
|
||||||
|
.ifPresent(session -> worldTimes.add(
|
||||||
|
session.getValue(SessionKeys.WORLD_TIMES).orElse(new WorldTimes(new HashMap<>())))
|
||||||
|
);
|
||||||
return worldTimes;
|
return worldTimes;
|
||||||
});
|
});
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.LAST_SEEN, SessionsMutator.forContainer(container)::toLastSeen);
|
container.putSupplier(PlayerKeys.LAST_SEEN, () -> SessionsMutator.forContainer(container).toLastSeen());
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.PLAYER_KILLS, SessionsMutator.forContainer(container)::toPlayerKillList);
|
container.putSupplier(PlayerKeys.PLAYER_KILLS, () -> SessionsMutator.forContainer(container).toPlayerKillList());
|
||||||
container.putSupplier(PlayerKeys.PLAYER_KILL_COUNT, container.getUnsafe(PlayerKeys.PLAYER_KILLS)::size);
|
container.putSupplier(PlayerKeys.PLAYER_KILL_COUNT, () -> container.getUnsafe(PlayerKeys.PLAYER_KILLS).size());
|
||||||
container.putSupplier(PlayerKeys.MOB_KILL_COUNT, SessionsMutator.forContainer(container)::toMobKillCount);
|
container.putSupplier(PlayerKeys.MOB_KILL_COUNT, () -> SessionsMutator.forContainer(container).toMobKillCount());
|
||||||
container.putSupplier(PlayerKeys.DEATH_COUNT, SessionsMutator.forContainer(container)::toDeathCount);
|
container.putSupplier(PlayerKeys.DEATH_COUNT, () -> SessionsMutator.forContainer(container).toDeathCount());
|
||||||
|
|
||||||
containers.add(container);
|
containers.add(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
return containers;
|
return containers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,14 +189,13 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Calculating getters
|
// Calculating getters
|
||||||
container.putSupplier(PlayerKeys.LAST_SEEN, SessionsMutator.forContainer(container)::toLastSeen);
|
container.putSupplier(PlayerKeys.LAST_SEEN, () -> SessionsMutator.forContainer(container).toLastSeen());
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.MOB_KILL_COUNT, SessionsMutator.forContainer(container)::toMobKillCount);
|
container.putSupplier(PlayerKeys.MOB_KILL_COUNT, () -> SessionsMutator.forContainer(container).toMobKillCount());
|
||||||
container.putSupplier(PlayerKeys.DEATH_COUNT, SessionsMutator.forContainer(container)::toDeathCount);
|
container.putSupplier(PlayerKeys.DEATH_COUNT, () -> SessionsMutator.forContainer(container).toDeathCount());
|
||||||
|
|
||||||
containers.add(container);
|
containers.add(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
return containers;
|
return containers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,13 +230,13 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
List<Session> serverSessions = sessionEntry.getValue();
|
List<Session> serverSessions = sessionEntry.getValue();
|
||||||
container.putRawData(PerServerKeys.SESSIONS, serverSessions);
|
container.putRawData(PerServerKeys.SESSIONS, serverSessions);
|
||||||
|
|
||||||
container.putSupplier(PerServerKeys.LAST_SEEN, SessionsMutator.forContainer(container)::toLastSeen);
|
container.putSupplier(PerServerKeys.LAST_SEEN, () -> SessionsMutator.forContainer(container).toLastSeen());
|
||||||
|
|
||||||
container.putSupplier(PerServerKeys.WORLD_TIMES, SessionsMutator.forContainer(container)::toTotalWorldTimes);
|
container.putSupplier(PerServerKeys.WORLD_TIMES, () -> SessionsMutator.forContainer(container).toTotalWorldTimes());
|
||||||
container.putSupplier(PerServerKeys.PLAYER_KILLS, SessionsMutator.forContainer(container)::toPlayerKillList);
|
container.putSupplier(PerServerKeys.PLAYER_KILLS, () -> SessionsMutator.forContainer(container).toPlayerKillList());
|
||||||
container.putSupplier(PerServerKeys.PLAYER_KILL_COUNT, container.getUnsafe(PerServerKeys.PLAYER_KILLS)::size);
|
container.putSupplier(PerServerKeys.PLAYER_KILL_COUNT, () -> container.getUnsafe(PerServerKeys.PLAYER_KILLS).size());
|
||||||
container.putSupplier(PerServerKeys.MOB_KILL_COUNT, SessionsMutator.forContainer(container)::toMobKillCount);
|
container.putSupplier(PerServerKeys.MOB_KILL_COUNT, () -> SessionsMutator.forContainer(container).toMobKillCount());
|
||||||
container.putSupplier(PerServerKeys.DEATH_COUNT, SessionsMutator.forContainer(container)::toDeathCount);
|
container.putSupplier(PerServerKeys.DEATH_COUNT, () -> SessionsMutator.forContainer(container).toDeathCount());
|
||||||
perServerContainer.put(serverUUID, container);
|
perServerContainer.put(serverUUID, container);
|
||||||
perServerContainers.put(uuid, perServerContainer);
|
perServerContainers.put(uuid, perServerContainer);
|
||||||
}
|
}
|
||||||
@ -253,8 +255,8 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
container.putSupplier(PlayerKeys.NICKNAMES, () -> nicknamesTable.getNicknameInformation(uuid));
|
container.putSupplier(PlayerKeys.NICKNAMES, () -> nicknamesTable.getNicknameInformation(uuid));
|
||||||
container.putSupplier(PlayerKeys.PER_SERVER, () -> getPerServerData(uuid));
|
container.putSupplier(PlayerKeys.PER_SERVER, () -> getPerServerData(uuid));
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.BANNED, new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER))::isBanned);
|
container.putSupplier(PlayerKeys.BANNED, () -> new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).isBanned());
|
||||||
container.putSupplier(PlayerKeys.OPERATOR, new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER))::isOperator);
|
container.putSupplier(PlayerKeys.OPERATOR, () -> new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).isOperator());
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.SESSIONS, () -> {
|
container.putSupplier(PlayerKeys.SESSIONS, () -> {
|
||||||
List<Session> sessions = new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).flatMapSessions();
|
List<Session> sessions = new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).flatMapSessions();
|
||||||
@ -265,16 +267,18 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
container.putSupplier(PlayerKeys.WORLD_TIMES, () ->
|
container.putSupplier(PlayerKeys.WORLD_TIMES, () ->
|
||||||
{
|
{
|
||||||
WorldTimes worldTimes = new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).flatMapWorldTimes();
|
WorldTimes worldTimes = new PerServerDataMutator(container.getUnsafe(PlayerKeys.PER_SERVER)).flatMapWorldTimes();
|
||||||
container.getValue(PlayerKeys.ACTIVE_SESSION).ifPresent(session -> worldTimes.add(session.getWorldTimes()));
|
container.getValue(PlayerKeys.ACTIVE_SESSION).ifPresent(session -> worldTimes.add(
|
||||||
|
session.getValue(SessionKeys.WORLD_TIMES).orElse(new WorldTimes(new HashMap<>())))
|
||||||
|
);
|
||||||
return worldTimes;
|
return worldTimes;
|
||||||
});
|
});
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.LAST_SEEN, SessionsMutator.forContainer(container)::toLastSeen);
|
container.putSupplier(PlayerKeys.LAST_SEEN, () -> SessionsMutator.forContainer(container).toLastSeen());
|
||||||
|
|
||||||
container.putSupplier(PlayerKeys.PLAYER_KILLS, SessionsMutator.forContainer(container)::toPlayerKillList);
|
container.putSupplier(PlayerKeys.PLAYER_KILLS, () -> SessionsMutator.forContainer(container).toPlayerKillList());
|
||||||
container.putSupplier(PlayerKeys.PLAYER_KILL_COUNT, container.getUnsafe(PlayerKeys.PLAYER_KILLS)::size);
|
container.putSupplier(PlayerKeys.PLAYER_KILL_COUNT, () -> container.getUnsafe(PlayerKeys.PLAYER_KILLS).size());
|
||||||
container.putSupplier(PlayerKeys.MOB_KILL_COUNT, SessionsMutator.forContainer(container)::toMobKillCount);
|
container.putSupplier(PlayerKeys.MOB_KILL_COUNT, () -> SessionsMutator.forContainer(container).toMobKillCount());
|
||||||
container.putSupplier(PlayerKeys.DEATH_COUNT, SessionsMutator.forContainer(container)::toDeathCount);
|
container.putSupplier(PlayerKeys.DEATH_COUNT, () -> SessionsMutator.forContainer(container).toDeathCount());
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
@ -302,13 +306,13 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
|
|||||||
DataContainer container = perServerContainer.getOrDefault(serverUUID, new DataContainer());
|
DataContainer container = perServerContainer.getOrDefault(serverUUID, new DataContainer());
|
||||||
container.putRawData(PerServerKeys.SESSIONS, serverSessions);
|
container.putRawData(PerServerKeys.SESSIONS, serverSessions);
|
||||||
|
|
||||||
container.putSupplier(PerServerKeys.LAST_SEEN, SessionsMutator.forContainer(container)::toLastSeen);
|
container.putSupplier(PerServerKeys.LAST_SEEN, () -> SessionsMutator.forContainer(container).toLastSeen());
|
||||||
|
|
||||||
container.putSupplier(PerServerKeys.WORLD_TIMES, SessionsMutator.forContainer(container)::toTotalWorldTimes);
|
container.putSupplier(PerServerKeys.WORLD_TIMES, () -> SessionsMutator.forContainer(container).toTotalWorldTimes());
|
||||||
container.putSupplier(PerServerKeys.PLAYER_KILLS, SessionsMutator.forContainer(container)::toPlayerKillList);
|
container.putSupplier(PerServerKeys.PLAYER_KILLS, () -> SessionsMutator.forContainer(container).toPlayerKillList());
|
||||||
container.putSupplier(PerServerKeys.PLAYER_KILL_COUNT, container.getUnsafe(PerServerKeys.PLAYER_KILLS)::size);
|
container.putSupplier(PerServerKeys.PLAYER_KILL_COUNT, () -> container.getUnsafe(PerServerKeys.PLAYER_KILLS).size());
|
||||||
container.putSupplier(PerServerKeys.MOB_KILL_COUNT, SessionsMutator.forContainer(container)::toMobKillCount);
|
container.putSupplier(PerServerKeys.MOB_KILL_COUNT, () -> SessionsMutator.forContainer(container).toMobKillCount());
|
||||||
container.putSupplier(PerServerKeys.DEATH_COUNT, SessionsMutator.forContainer(container)::toDeathCount);
|
container.putSupplier(PerServerKeys.DEATH_COUNT, () -> SessionsMutator.forContainer(container).toDeathCount());
|
||||||
|
|
||||||
perServerContainer.put(serverUUID, container);
|
perServerContainer.put(serverUUID, container);
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class NicknamesTable extends UserIDTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void alterTableV19() {
|
public void alterTableV19() {
|
||||||
addColumns(Col.LAST_USED + " " + Sql.LONG + "NOT NULL DEFAULT '0'");
|
addColumns(Col.LAST_USED + " bigint NOT NULL DEFAULT '0'");
|
||||||
|
|
||||||
RunnableFactory.createNew(new AbsRunnable("DB version 18->19") {
|
RunnableFactory.createNew(new AbsRunnable("DB version 18->19") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,7 +5,9 @@ import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
|||||||
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
|
||||||
import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement;
|
import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement;
|
||||||
import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement;
|
import com.djrapitops.plan.system.database.databases.sql.processing.QueryStatement;
|
||||||
|
import com.djrapitops.plan.system.settings.Settings;
|
||||||
import com.djrapitops.plan.utilities.MiscUtils;
|
import com.djrapitops.plan.utilities.MiscUtils;
|
||||||
|
import com.djrapitops.plugin.api.utility.log.Log;
|
||||||
import com.djrapitops.plugin.utilities.Verify;
|
import com.djrapitops.plugin.utilities.Verify;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
@ -101,8 +103,10 @@ public abstract class Table {
|
|||||||
for (String statement : statements) {
|
for (String statement : statements) {
|
||||||
try {
|
try {
|
||||||
execute(statement);
|
execute(statement);
|
||||||
} catch (DBOpException ignored) {
|
} catch (DBOpException e) {
|
||||||
/* ignored */
|
if (Settings.DEV_MODE.isTrue()) {
|
||||||
|
Log.toLog(this.getClass(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class NetworkPage extends Page {
|
|||||||
PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer();
|
PlaceholderReplacer placeholderReplacer = new PlaceholderReplacer();
|
||||||
placeholderReplacer.addAllPlaceholdersFrom(networkContainer,
|
placeholderReplacer.addAllPlaceholdersFrom(networkContainer,
|
||||||
VERSION, NETWORK_NAME, TIME_ZONE,
|
VERSION, NETWORK_NAME, TIME_ZONE,
|
||||||
PLAYERS_ONLINE_SERIES, PLAYERS_TOTAL, PLAYERS_GRAPH_COLOR,
|
PLAYERS_ONLINE, PLAYERS_ONLINE_SERIES, PLAYERS_TOTAL, PLAYERS_GRAPH_COLOR,
|
||||||
REFRESH_TIME_F, RECENT_PEAK_TIME_F, ALL_TIME_PEAK_TIME_F,
|
REFRESH_TIME_F, RECENT_PEAK_TIME_F, ALL_TIME_PEAK_TIME_F,
|
||||||
PLAYERS_ALL_TIME_PEAK, PLAYERS_RECENT_PEAK,
|
PLAYERS_ALL_TIME_PEAK, PLAYERS_RECENT_PEAK,
|
||||||
PLAYERS_DAY, PLAYERS_WEEK, PLAYERS_MONTH,
|
PLAYERS_DAY, PLAYERS_WEEK, PLAYERS_MONTH,
|
||||||
@ -40,7 +40,7 @@ public class NetworkPage extends Page {
|
|||||||
);
|
);
|
||||||
NetworkPageContent networkPageContent = (NetworkPageContent)
|
NetworkPageContent networkPageContent = (NetworkPageContent)
|
||||||
ResponseCache.loadResponse(PageId.NETWORK_CONTENT.id(), NetworkPageContent::new);
|
ResponseCache.loadResponse(PageId.NETWORK_CONTENT.id(), NetworkPageContent::new);
|
||||||
addValue("tabContentServers", networkPageContent.getContents());
|
placeholderReplacer.put("tabContentServers", networkPageContent.getContents());
|
||||||
|
|
||||||
return placeholderReplacer.apply(FileUtil.getStringFromResource("web/network.html"));
|
return placeholderReplacer.apply(FileUtil.getStringFromResource("web/network.html"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -23,13 +23,10 @@ public abstract class Page {
|
|||||||
this.placeHolders = new HashMap<>();
|
this.placeHolders = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
protected void addValue(String placeholder, Serializable value) {
|
protected void addValue(String placeholder, Serializable value) {
|
||||||
placeHolders.put(placeholder, value);
|
placeHolders.put(placeholder, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addValues(Map<String, Serializable> values) {
|
|
||||||
placeHolders.putAll(values);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String toHtml() throws ParseException;
|
public abstract String toHtml() throws ParseException;
|
||||||
}
|
}
|
@ -32,7 +32,7 @@ public class PlayersTable extends TableContainer {
|
|||||||
Html.FONT_AWESOME_ICON.parse("clock-o") + " Playtime",
|
Html.FONT_AWESOME_ICON.parse("clock-o") + " Playtime",
|
||||||
Html.FONT_AWESOME_ICON.parse("calendar-plus-o") + " Sessions",
|
Html.FONT_AWESOME_ICON.parse("calendar-plus-o") + " Sessions",
|
||||||
Html.FONT_AWESOME_ICON.parse("user-plus") + " Registered",
|
Html.FONT_AWESOME_ICON.parse("user-plus") + " Registered",
|
||||||
Html.FONT_AWESOME_ICON.parse("calendar-check-o") + " Registered",
|
Html.FONT_AWESOME_ICON.parse("calendar-check-o") + " Last Seen",
|
||||||
Html.FONT_AWESOME_ICON.parse("globe") + " Geolocation"
|
Html.FONT_AWESOME_ICON.parse("globe") + " Geolocation"
|
||||||
);
|
);
|
||||||
this.players = players;
|
this.players = players;
|
||||||
|
Loading…
Reference in New Issue
Block a user