mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-16 15:45:16 +01:00
Add join address to player pages
- On the main information card - On each servers accordion Affects issues: - Close #2255
This commit is contained in:
parent
019b59128f
commit
18ea0aac8c
@ -48,6 +48,7 @@ public class PerServerContainer extends HashMap<ServerUUID, DataContainer> {
|
|||||||
putToContainerOfServer(serverUUID, PerServerKeys.REGISTERED, userInfo.getRegistered());
|
putToContainerOfServer(serverUUID, PerServerKeys.REGISTERED, userInfo.getRegistered());
|
||||||
putToContainerOfServer(serverUUID, PerServerKeys.BANNED, userInfo.isBanned());
|
putToContainerOfServer(serverUUID, PerServerKeys.BANNED, userInfo.isBanned());
|
||||||
putToContainerOfServer(serverUUID, PerServerKeys.OPERATOR, userInfo.isOperator());
|
putToContainerOfServer(serverUUID, PerServerKeys.OPERATOR, userInfo.isOperator());
|
||||||
|
putToContainerOfServer(serverUUID, PerServerKeys.JOIN_ADDRESS, userInfo.getJoinAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putUserInfo(Collection<UserInfo> userInformation) {
|
public void putUserInfo(Collection<UserInfo> userInformation) {
|
||||||
|
@ -55,6 +55,7 @@ public class CommonKeys {
|
|||||||
|
|
||||||
public static final Key<Boolean> BANNED = new Key<>(Boolean.class, "banned");
|
public static final Key<Boolean> BANNED = new Key<>(Boolean.class, "banned");
|
||||||
public static final Key<Boolean> OPERATOR = new Key<>(Boolean.class, "operator");
|
public static final Key<Boolean> OPERATOR = new Key<>(Boolean.class, "operator");
|
||||||
|
public static final Key<String> JOIN_ADDRESS = new Key<>(String.class, "join_address");
|
||||||
|
|
||||||
public static final Key<SessionsMutator> SESSIONS_MUTATOR = new Key<>(SessionsMutator.class, "SESSIONS_MUTATOR");
|
public static final Key<SessionsMutator> SESSIONS_MUTATOR = new Key<>(SessionsMutator.class, "SESSIONS_MUTATOR");
|
||||||
public static final Key<TPSMutator> TPS_MUTATOR = new Key<>(TPSMutator.class, "TPS_MUTATOR");
|
public static final Key<TPSMutator> TPS_MUTATOR = new Key<>(TPSMutator.class, "TPS_MUTATOR");
|
||||||
|
@ -55,5 +55,6 @@ public class PerServerKeys {
|
|||||||
|
|
||||||
public static final Key<Boolean> BANNED = CommonKeys.BANNED;
|
public static final Key<Boolean> BANNED = CommonKeys.BANNED;
|
||||||
public static final Key<Boolean> OPERATOR = CommonKeys.OPERATOR;
|
public static final Key<Boolean> OPERATOR = CommonKeys.OPERATOR;
|
||||||
|
public static final Key<String> JOIN_ADDRESS = CommonKeys.JOIN_ADDRESS;
|
||||||
|
|
||||||
}
|
}
|
@ -114,4 +114,18 @@ public class PerServerMutator {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<String> latestJoinAddress() {
|
||||||
|
long latest = Long.MIN_VALUE;
|
||||||
|
String latestJoinAddress = null;
|
||||||
|
for (DataContainer value : data.values()) {
|
||||||
|
long registerDate = value.getValue(PerServerKeys.REGISTERED).orElse(Long.MIN_VALUE);
|
||||||
|
Optional<String> joinAddress = value.getValue(PerServerKeys.JOIN_ADDRESS);
|
||||||
|
if (registerDate > latest && joinAddress.isPresent()) {
|
||||||
|
latest = registerDate;
|
||||||
|
latestJoinAddress = joinAddress.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.ofNullable(latestJoinAddress);
|
||||||
|
}
|
||||||
}
|
}
|
@ -182,6 +182,7 @@ public class PlayerJSONCreator {
|
|||||||
info.put("activity_index", decimals.apply(activityIndex.getValue()));
|
info.put("activity_index", decimals.apply(activityIndex.getValue()));
|
||||||
info.put("activity_index_group", activityIndex.getGroup());
|
info.put("activity_index_group", activityIndex.getGroup());
|
||||||
info.put("favorite_server", perServer.favoriteServer().map(favoriteServer -> serverNames.getOrDefault(favoriteServer, favoriteServer.toString())).orElse(locale.getString(GenericLang.UNKNOWN)));
|
info.put("favorite_server", perServer.favoriteServer().map(favoriteServer -> serverNames.getOrDefault(favoriteServer, favoriteServer.toString())).orElse(locale.getString(GenericLang.UNKNOWN)));
|
||||||
|
info.put("latest_join_address", perServer.latestJoinAddress().orElse("-"));
|
||||||
double averagePing = ping.average();
|
double averagePing = ping.average();
|
||||||
int worstPing = ping.max();
|
int worstPing = ping.max();
|
||||||
int bestPing = ping.min();
|
int bestPing = ping.min();
|
||||||
|
@ -83,6 +83,7 @@ public class ServerAccordion {
|
|||||||
server.put("operator", ofServer.getValue(PerServerKeys.OPERATOR).orElse(false));
|
server.put("operator", ofServer.getValue(PerServerKeys.OPERATOR).orElse(false));
|
||||||
server.put("registered", year.apply(ofServer.getValue(PerServerKeys.REGISTERED).orElse(0L)));
|
server.put("registered", year.apply(ofServer.getValue(PerServerKeys.REGISTERED).orElse(0L)));
|
||||||
server.put("last_seen", year.apply(sessionsMutator.toLastSeen()));
|
server.put("last_seen", year.apply(sessionsMutator.toLastSeen()));
|
||||||
|
server.put("join_address", ofServer.getValue(PerServerKeys.JOIN_ADDRESS).orElse("-"));
|
||||||
|
|
||||||
server.put("session_count", sessionsMutator.count());
|
server.put("session_count", sessionsMutator.count());
|
||||||
server.put("playtime", timeAmount.apply(sessionsMutator.toPlaytime()));
|
server.put("playtime", timeAmount.apply(sessionsMutator.toPlaytime()));
|
||||||
|
@ -30,6 +30,7 @@ function loadPlayerOverviewValues(json, error) {
|
|||||||
$(element).find("#data_activity_index").text(data.activity_index);
|
$(element).find("#data_activity_index").text(data.activity_index);
|
||||||
$(element).find("#data_activity_index_group").text(data.activity_index_group);
|
$(element).find("#data_activity_index_group").text(data.activity_index_group);
|
||||||
$(element).find("#data_favorite_server").text(data.favorite_server);
|
$(element).find("#data_favorite_server").text(data.favorite_server);
|
||||||
|
$(element).find("#data_latest_join_address").text(data.latest_join_address);
|
||||||
$(element).find("#data_average_ping").text(data.average_ping);
|
$(element).find("#data_average_ping").text(data.average_ping);
|
||||||
$(element).find("#data_best_ping").text(data.best_ping);
|
$(element).find("#data_best_ping").text(data.best_ping);
|
||||||
$(element).find("#data_worst_ping").text(data.worst_ping);
|
$(element).find("#data_worst_ping").text(data.worst_ping);
|
||||||
@ -223,6 +224,8 @@ function createserverAccordionBody(i, server) {
|
|||||||
`<p><i class="col-teal far fa-fw fa-clock"></i> Longest Session<span class="float-end"><b>` + server.longest_session_length + `</b></span></p>` +
|
`<p><i class="col-teal far fa-fw fa-clock"></i> Longest Session<span class="float-end"><b>` + server.longest_session_length + `</b></span></p>` +
|
||||||
`<p><i class="col-teal far fa-fw fa-clock"></i> Session Median<span class="float-end"><b>` + server.session_median + `</b></span></p>` +
|
`<p><i class="col-teal far fa-fw fa-clock"></i> Session Median<span class="float-end"><b>` + server.session_median + `</b></span></p>` +
|
||||||
`<br>` +
|
`<br>` +
|
||||||
|
`<p><i class="col-amber fa fa-fw fa-location-arrow"></i> Join Address<span class="float-end">` + server.join_address + `</span></p>` +
|
||||||
|
`<br>` +
|
||||||
`<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span class="float-end"><b>` + server.player_kills + `</b></span></p>` +
|
`<p><i class="col-red fa fa-fw fa-crosshairs"></i> Player Kills<span class="float-end"><b>` + server.player_kills + `</b></span></p>` +
|
||||||
`<p><i class="col-green fa fa-fw fa-crosshairs"></i> Mob Kills<span class="float-end"><b>` + server.mob_kills + `</b></span></p>` +
|
`<p><i class="col-green fa fa-fw fa-crosshairs"></i> Mob Kills<span class="float-end"><b>` + server.mob_kills + `</b></span></p>` +
|
||||||
`<p><i class=" fa fa-fw fa-skull"></i> Deaths<span class="float-end"><b>` + server.deaths + `</b></span></p>` +
|
`<p><i class=" fa fa-fw fa-skull"></i> Deaths<span class="float-end"><b>` + server.deaths + `</b></span></p>` +
|
||||||
|
@ -184,7 +184,8 @@
|
|||||||
id="data_activity_index_group"></span>)</span></p>
|
id="data_activity_index_group"></span>)</span></p>
|
||||||
<p><i class="col-green fa fa-fw fa-server"></i> Favorite Server <span
|
<p><i class="col-green fa fa-fw fa-server"></i> Favorite Server <span
|
||||||
class="float-end" id="data_favorite_server"></span></p>
|
class="float-end" id="data_favorite_server"></span></p>
|
||||||
<p> </p>
|
<p><i class="col-amber fa fa-fw fa-location-arrow"></i> Join Address<span
|
||||||
|
class="float-end" id="data_latest_join_address"></span></p>
|
||||||
<hr>
|
<hr>
|
||||||
<p><i class="col-amber fa fa-fw fa-signal"></i> Average Ping <span
|
<p><i class="col-amber fa fa-fw fa-signal"></i> Average Ping <span
|
||||||
class="float-end" id="data_average_ping"></span></p>
|
class="float-end" id="data_average_ping"></span></p>
|
||||||
|
Loading…
Reference in New Issue
Block a user