mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-03-12 14:49:56 +01:00
PlayersTableCreator bug fixes
This commit is contained in:
parent
d5df4381d4
commit
475f3b83c1
@ -27,6 +27,10 @@ public class PlayersTableCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String createSortablePlayersTable(List<UserInfo> userInfo, JoinInfoPart joinInfoPart, GeolocationPart geolocationPart) {
|
public static String createSortablePlayersTable(List<UserInfo> userInfo, JoinInfoPart joinInfoPart, GeolocationPart geolocationPart) {
|
||||||
|
if (userInfo.isEmpty()) {
|
||||||
|
return Html.TABLELINE_PLAYERS.parse("No Players", "", "", "", "", "", "", "", "", "");
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder html = new StringBuilder();
|
StringBuilder html = new StringBuilder();
|
||||||
|
|
||||||
Map<UUID, List<Session>> sessions = joinInfoPart.getSessions();
|
Map<UUID, List<Session>> sessions = joinInfoPart.getSessions();
|
||||||
@ -45,16 +49,17 @@ public class PlayersTableCreator {
|
|||||||
boolean isBanned = user.isBanned();
|
boolean isBanned = user.isBanned();
|
||||||
List<Session> userSessions = sessions.get(uuid);
|
List<Session> userSessions = sessions.get(uuid);
|
||||||
int loginTimes = 0;
|
int loginTimes = 0;
|
||||||
|
long playtime = 0;
|
||||||
if (userSessions != null) {
|
if (userSessions != null) {
|
||||||
loginTimes = userSessions.size();
|
loginTimes = userSessions.size();
|
||||||
|
playtime = AnalysisUtils.getTotalPlaytime(userSessions);
|
||||||
}
|
}
|
||||||
boolean isUnknown = loginTimes == 1;
|
boolean isUnknown = loginTimes == 1;
|
||||||
long registered = user.getRegistered();
|
long registered = user.getRegistered();
|
||||||
long playtime = AnalysisUtils.getTotalPlaytime(userSessions);
|
|
||||||
|
|
||||||
boolean isActive = AnalysisUtils.isActive(now, user.getLastSeen(), playtime, loginTimes);
|
boolean isActive = AnalysisUtils.isActive(now, user.getLastSeen(), playtime, loginTimes);
|
||||||
|
|
||||||
long lastSeen = AnalysisUtils.getLastSeen(userSessions);
|
long lastSeen = user.getLastSeen();
|
||||||
|
|
||||||
String activityString = getActivityString(isBanned, isUnknown, isActive);
|
String activityString = getActivityString(isBanned, isUnknown, isActive);
|
||||||
|
|
||||||
@ -73,6 +78,7 @@ public class PlayersTableCreator {
|
|||||||
String.valueOf(geoLocation)
|
String.valueOf(geoLocation)
|
||||||
));
|
));
|
||||||
} catch (NullPointerException ignored) {
|
} catch (NullPointerException ignored) {
|
||||||
|
ignored.printStackTrace(); // TODO IGNORE AGAIN
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
Loading…
Reference in New Issue
Block a user