mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Added some missing things to InspectPageParser
This commit is contained in:
parent
8c889698f9
commit
6981b222af
@ -102,6 +102,19 @@ public class PlayerProfile implements OfflinePlayer {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getFavoriteServer() {
|
||||||
|
long max = 0L;
|
||||||
|
UUID maxServer = null;
|
||||||
|
for (Map.Entry<UUID, WorldTimes> entry : getWorldTimesPerServer().entrySet()) {
|
||||||
|
long playTime = entry.getValue().getTotal();
|
||||||
|
if (playTime < max) {
|
||||||
|
max = playTime;
|
||||||
|
maxServer = entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxServer;
|
||||||
|
}
|
||||||
|
|
||||||
public long getLastSeen() {
|
public long getLastSeen() {
|
||||||
return getLastSeen(getAllSessions());
|
return getLastSeen(getAllSessions());
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import main.java.com.djrapitops.plan.Settings;
|
|||||||
import main.java.com.djrapitops.plan.api.IPlan;
|
import main.java.com.djrapitops.plan.api.IPlan;
|
||||||
import main.java.com.djrapitops.plan.api.exceptions.ParseException;
|
import main.java.com.djrapitops.plan.api.exceptions.ParseException;
|
||||||
import main.java.com.djrapitops.plan.data.Action;
|
import main.java.com.djrapitops.plan.data.Action;
|
||||||
|
import main.java.com.djrapitops.plan.data.GeoInfo;
|
||||||
import main.java.com.djrapitops.plan.data.PlayerProfile;
|
import main.java.com.djrapitops.plan.data.PlayerProfile;
|
||||||
import main.java.com.djrapitops.plan.data.Session;
|
import main.java.com.djrapitops.plan.data.Session;
|
||||||
import main.java.com.djrapitops.plan.data.time.WorldTimes;
|
import main.java.com.djrapitops.plan.data.time.WorldTimes;
|
||||||
@ -82,20 +83,27 @@ public class InspectPageParser extends PageParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<UUID, String> serverNames = db.getServerTable().getServerNames();
|
Map<UUID, String> serverNames = db.getServerTable().getServerNames();
|
||||||
|
|
||||||
Map<UUID, WorldTimes> worldTimesPerServer = profile.getWorldTimesPerServer();
|
Map<UUID, WorldTimes> worldTimesPerServer = profile.getWorldTimesPerServer();
|
||||||
addValue("serverPieSeries", ServerPreferencePieCreator.createSeriesData(serverNames, worldTimesPerServer));
|
addValue("serverPieSeries", ServerPreferencePieCreator.createSeriesData(serverNames, worldTimesPerServer));
|
||||||
addValue("worldPieColors", Settings.THEME_GRAPH_WORLD_PIE.toString());
|
addValue("worldPieColors", Settings.THEME_GRAPH_WORLD_PIE.toString());
|
||||||
addValue("gmPieColors", Settings.THEME_GRAPH_GM_PIE.toString());
|
addValue("gmPieColors", Settings.THEME_GRAPH_GM_PIE.toString());
|
||||||
addValue("serverPieColors", Settings.THEME_GRAPH_SERVER_PREF_PIE.toString());
|
addValue("serverPieColors", Settings.THEME_GRAPH_SERVER_PREF_PIE.toString());
|
||||||
|
|
||||||
|
String favoriteServer = serverNames.get(profile.getFavoriteServer());
|
||||||
|
addValue("favoriteServer", favoriteServer != null ? favoriteServer : "Unknown");
|
||||||
|
|
||||||
// TODO IP Timestamp table
|
// TODO IP Timestamp table
|
||||||
// List<String> geolocations = db.getIpsTable().getGeolocations(uuid);
|
|
||||||
List<String> nicknames = profile.getNicknames().stream()
|
List<String> nicknames = profile.getNicknames().stream()
|
||||||
.map(HtmlUtils::swapColorsToSpan)
|
.map(HtmlUtils::swapColorsToSpan)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
List<String> geoLocations = profile.getGeoInformation().stream()
|
||||||
|
.map(GeoInfo::getGeolocation)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// TODO REMOVE after 4.1.0
|
||||||
addValue("nicknames", HtmlStructure.createDotList(nicknames.toArray(new String[nicknames.size()])));
|
addValue("nicknames", HtmlStructure.createDotList(nicknames.toArray(new String[nicknames.size()])));
|
||||||
// addValue("geolocations", HtmlStructure.createDotList(geolocations.toArray(new String[geolocations.size()])));
|
addValue("geolocations", HtmlStructure.createDotList(geoLocations.toArray(new String[geoLocations.size()])));
|
||||||
|
|
||||||
Map<UUID, List<Session>> sessions = profile.getSessions();
|
Map<UUID, List<Session>> sessions = profile.getSessions();
|
||||||
Map<String, List<Session>> sessionsByServerName = sessions.entrySet().stream()
|
Map<String, List<Session>> sessionsByServerName = sessions.entrySet().stream()
|
||||||
@ -173,7 +181,7 @@ public class InspectPageParser extends PageParser {
|
|||||||
addValue("tableBodyActions", ActionsTableCreator.createTable(actions));
|
addValue("tableBodyActions", ActionsTableCreator.createTable(actions));
|
||||||
|
|
||||||
String punchCardData = PunchCardGraphCreator.createDataSeries(allSessions);
|
String punchCardData = PunchCardGraphCreator.createDataSeries(allSessions);
|
||||||
WorldTimes worldTimes = db.getWorldTimesTable().getWorldTimesOfUser(uuid);
|
WorldTimes worldTimes = profile.getWorldTimes();
|
||||||
AnalysisUtils.addMissingWorlds(worldTimes);
|
AnalysisUtils.addMissingWorlds(worldTimes);
|
||||||
|
|
||||||
String[] worldPieData = WorldPieCreator.createSeriesData(worldTimes);
|
String[] worldPieData = WorldPieCreator.createSeriesData(worldTimes);
|
||||||
|
Loading…
Reference in New Issue
Block a user