Server: improved ping info (added last activity time)

This commit is contained in:
Oleg Agafonov 2020-02-01 10:49:00 +04:00
parent 2079065af3
commit f4a0c70cf3
3 changed files with 22 additions and 16 deletions

View file

@ -1192,7 +1192,7 @@ public class GameController implements GameCallback {
List<String> usersInfo = new ArrayList<>();
for (Map.Entry<UUID, UUID> entry : userPlayerMap.entrySet()) {
Optional<User> user = UserManager.instance.getUser(entry.getKey());
user.ifPresent(u -> usersInfo.add(u.getName() + ": " + u.getPingInfo()));
user.ifPresent(u -> usersInfo.add("* " + u.getName() + ": " + u.getPingInfo()));
}
Collections.sort(usersInfo);
usersInfo.add(0, "Players ping:");
@ -1200,7 +1200,7 @@ public class GameController implements GameCallback {
List<String> watchersinfo = new ArrayList<>();
for (Map.Entry<UUID, GameSessionWatcher> entry : watchers.entrySet()) {
Optional<User> user = UserManager.instance.getUser(entry.getValue().userId);
user.ifPresent(u -> watchersinfo.add(u.getName() + ": " + u.getPingInfo()));
user.ifPresent(u -> watchersinfo.add("* " + u.getName() + ": " + u.getPingInfo()));
}
Collections.sort(watchersinfo);
if (watchersinfo.size() > 0) {