mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-12 03:13:46 +01:00
Fixed issue with getUnsafe(SessionKeys.END) #632
This commit is contained in:
parent
e3118c57a4
commit
6f11dc33ac
@ -93,7 +93,7 @@ public class QInspectCommand extends CommandNode {
|
|||||||
}).runTaskAsynchronously();
|
}).runTaskAsynchronously();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMessages(ISender sender, PlayerContainer container) {
|
private void sendMessages(ISender sender, PlayerContainer player) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
ColorScheme colorScheme = plugin.getColorScheme();
|
ColorScheme colorScheme = plugin.getColorScheme();
|
||||||
@ -104,15 +104,15 @@ public class QInspectCommand extends CommandNode {
|
|||||||
Formatter<DateHolder> timestamp = Formatters.year();
|
Formatter<DateHolder> timestamp = Formatters.year();
|
||||||
Formatter<Long> length = Formatters.timeAmount();
|
Formatter<Long> length = Formatters.timeAmount();
|
||||||
|
|
||||||
sender.sendMessage(Locale.get(Msg.CMD_HEADER_INSPECT).toString() + ": " + colT + container.getValue(PlayerKeys.NAME).orElse("Unknown"));
|
sender.sendMessage(Locale.get(Msg.CMD_HEADER_INSPECT).toString() + ": " + colT + player.getValue(PlayerKeys.NAME).orElse("Unknown"));
|
||||||
|
|
||||||
ActivityIndex activityIndex = container.getActivityIndex(now);
|
ActivityIndex activityIndex = player.getActivityIndex(now);
|
||||||
Long registered = container.getValue(PlayerKeys.REGISTERED).orElse(0L);
|
Long registered = player.getValue(PlayerKeys.REGISTERED).orElse(0L);
|
||||||
Long lastSeen = container.getValue(PlayerKeys.LAST_SEEN).orElse(0L);
|
Long lastSeen = player.getValue(PlayerKeys.LAST_SEEN).orElse(0L);
|
||||||
List<GeoInfo> geoInfo = container.getValue(PlayerKeys.GEO_INFO).orElse(new ArrayList<>());
|
List<GeoInfo> geoInfo = player.getValue(PlayerKeys.GEO_INFO).orElse(new ArrayList<>());
|
||||||
Optional<GeoInfo> mostRecentGeoInfo = new GeoInfoMutator(geoInfo).mostRecent();
|
Optional<GeoInfo> mostRecentGeoInfo = new GeoInfoMutator(geoInfo).mostRecent();
|
||||||
String loginLocation = mostRecentGeoInfo.isPresent() ? mostRecentGeoInfo.get().getGeolocation() : "-";
|
String loginLocation = mostRecentGeoInfo.isPresent() ? mostRecentGeoInfo.get().getGeolocation() : "-";
|
||||||
SessionsMutator sessionsMutator = SessionsMutator.forContainer(container);
|
SessionsMutator sessionsMutator = SessionsMutator.forContainer(player);
|
||||||
|
|
||||||
sender.sendMessage(colM + " Activity Index: " + colS + activityIndex.getFormattedValue() + " | " + activityIndex.getGroup());
|
sender.sendMessage(colM + " Activity Index: " + colS + activityIndex.getFormattedValue() + " | " + activityIndex.getGroup());
|
||||||
sender.sendMessage(colM + " Registered: " + colS + timestamp.apply(() -> registered));
|
sender.sendMessage(colM + " Registered: " + colS + timestamp.apply(() -> registered));
|
||||||
@ -120,7 +120,7 @@ public class QInspectCommand extends CommandNode {
|
|||||||
sender.sendMessage(colM + " Logged in from: " + colS + loginLocation);
|
sender.sendMessage(colM + " Logged in from: " + colS + loginLocation);
|
||||||
sender.sendMessage(colM + " Playtime: " + colS + length.apply(sessionsMutator.toPlaytime()));
|
sender.sendMessage(colM + " Playtime: " + colS + length.apply(sessionsMutator.toPlaytime()));
|
||||||
sender.sendMessage(colM + " Longest Session: " + colS + length.apply(sessionsMutator.toLongestSessionLength()));
|
sender.sendMessage(colM + " Longest Session: " + colS + length.apply(sessionsMutator.toLongestSessionLength()));
|
||||||
sender.sendMessage(colM + " Times Kicked: " + colS + container.getValue(PlayerKeys.KICK_COUNT).orElse(0));
|
sender.sendMessage(colM + " Times Kicked: " + colS + player.getValue(PlayerKeys.KICK_COUNT).orElse(0));
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage(colM + " Player Kills : " + colS + sessionsMutator.toPlayerKillCount());
|
sender.sendMessage(colM + " Player Kills : " + colS + sessionsMutator.toPlayerKillCount());
|
||||||
sender.sendMessage(colM + " Mob Kills : " + colS + sessionsMutator.toMobKillCount());
|
sender.sendMessage(colM + " Mob Kills : " + colS + sessionsMutator.toMobKillCount());
|
||||||
|
@ -11,7 +11,6 @@ import com.djrapitops.plan.data.store.keys.SessionKeys;
|
|||||||
import com.djrapitops.plan.data.store.objects.DateObj;
|
import com.djrapitops.plan.data.store.objects.DateObj;
|
||||||
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.Predicate;
|
import java.util.function.Predicate;
|
||||||
@ -35,9 +34,6 @@ 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,7 +7,6 @@ import com.djrapitops.plan.data.store.containers.DataContainer;
|
|||||||
import com.djrapitops.plan.data.store.keys.CommonKeys;
|
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.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.Predicate;
|
import java.util.function.Predicate;
|
||||||
@ -25,9 +24,6 @@ public class SessionsMutator {
|
|||||||
private List<Session> sessions;
|
private List<Session> sessions;
|
||||||
|
|
||||||
public static SessionsMutator forContainer(DataContainer container) {
|
public static SessionsMutator forContainer(DataContainer container) {
|
||||||
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<>()));
|
return new SessionsMutator(container.getValue(CommonKeys.SESSIONS).orElse(new ArrayList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ 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.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;
|
||||||
@ -29,9 +28,6 @@ public class TPSMutator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TPSMutator forContainer(DataContainer container) {
|
public static TPSMutator forContainer(DataContainer container) {
|
||||||
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<>()));
|
return new TPSMutator(container.getValue(ServerKeys.TPS).orElse(new ArrayList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class PingTable extends UserIDTable {
|
|||||||
Col.AVG_PING +
|
Col.AVG_PING +
|
||||||
") VALUES (" +
|
") VALUES (" +
|
||||||
usersTable.statementSelectID + ", " +
|
usersTable.statementSelectID + ", " +
|
||||||
serverTable.statementSelectServerID + ", ?, ?)";
|
serverTable.statementSelectServerID + ", ?, ?, ?, ?)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -199,6 +199,11 @@ public class PingTable extends UserIDTable {
|
|||||||
public String get() {
|
public String get() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,8 @@ public class PlayerCalendar {
|
|||||||
|
|
||||||
series.append(",{title: 'Session: ").append(length)
|
series.append(",{title: 'Session: ").append(length)
|
||||||
.append("',start:").append(session.getUnsafe(SessionKeys.START))
|
.append("',start:").append(session.getUnsafe(SessionKeys.START))
|
||||||
.append(",end:").append(session.getUnsafe(SessionKeys.END))
|
.append(",end:").append(session.getValue(SessionKeys.END)
|
||||||
|
.orElse(System.currentTimeMillis()))
|
||||||
.append("}");
|
.append("}");
|
||||||
|
|
||||||
for (PlayerKill kill : session.getUnsafe(SessionKeys.PLAYER_KILLS)) {
|
for (PlayerKill kill : session.getUnsafe(SessionKeys.PLAYER_KILLS)) {
|
||||||
|
@ -105,7 +105,7 @@ public class AnalysisPluginsTabContentCreator {
|
|||||||
PlanPlugin plugin = PlanPlugin.getInstance();
|
PlanPlugin plugin = PlanPlugin.getInstance();
|
||||||
StaticHolder.saveInstance(AnalysisPluginsTabContentCreator.class, plugin.getClass());
|
StaticHolder.saveInstance(AnalysisPluginsTabContentCreator.class, plugin.getClass());
|
||||||
try {
|
try {
|
||||||
Benchmark.start("Analysis", "Analysis: Source " + source.getSourcePlugin());
|
Benchmark.start("Analysis: Source " + source.getSourcePlugin());
|
||||||
|
|
||||||
source.setAnalysisData(analysisContainer);
|
source.setAnalysisData(analysisContainer);
|
||||||
AnalysisContainer container = source.getServerData(uuids, new AnalysisContainer());
|
AnalysisContainer container = source.getServerData(uuids, new AnalysisContainer());
|
||||||
|
@ -68,7 +68,6 @@ public class ServerAccordion extends AbstractAccordion {
|
|||||||
DataContainer container = entry.getValue();
|
DataContainer container = entry.getValue();
|
||||||
String serverName = serverNames.getOrDefault(serverUUID, "Unknown");
|
String serverName = serverNames.getOrDefault(serverUUID, "Unknown");
|
||||||
WorldTimes worldTimes = container.getValue(PerServerKeys.WORLD_TIMES).orElse(new WorldTimes(new HashMap<>()));
|
WorldTimes worldTimes = container.getValue(PerServerKeys.WORLD_TIMES).orElse(new WorldTimes(new HashMap<>()));
|
||||||
|
|
||||||
SessionsMutator sessionsMutator = SessionsMutator.forContainer(container);
|
SessionsMutator sessionsMutator = SessionsMutator.forContainer(container);
|
||||||
|
|
||||||
boolean banned = container.getValue(PerServerKeys.BANNED).orElse(false);
|
boolean banned = container.getValue(PerServerKeys.BANNED).orElse(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user