From b0f173a72689c26c2ed9d35a27fe18215a38e709 Mon Sep 17 00:00:00 2001 From: Cow Date: Fri, 14 Oct 2022 13:52:10 +0200 Subject: Fixed long-term offline players being displayed in `/moo online` --- src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java | 2 +- src/main/java/de/cowtipper/cowlection/handler/FriendsHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java b/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java index 5bb9a85..01c1fc8 100644 --- a/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java +++ b/src/main/java/de/cowtipper/cowlection/data/HyPlayerData.java @@ -58,7 +58,7 @@ public class HyPlayerData { } public boolean hasNeverLoggedOut() { - // example player that has no logout value (as of April 2020): Pig (in general accounts that haven't logged in for a few years) + // example player that has no logout value (as of October 2022): Creeper (in general accounts that haven't logged in for a few years) return lastLogin != 0 && lastLogout == 0; } diff --git a/src/main/java/de/cowtipper/cowlection/handler/FriendsHandler.java b/src/main/java/de/cowtipper/cowlection/handler/FriendsHandler.java index c2c6837..9034b17 100644 --- a/src/main/java/de/cowtipper/cowlection/handler/FriendsHandler.java +++ b/src/main/java/de/cowtipper/cowlection/handler/FriendsHandler.java @@ -161,7 +161,7 @@ public class FriendsHandler { for (Friend bestFriend : bestFriends) { bestFriendOnlineStatusQueue.incrementAndGet(); ApiUtils.fetchHyPlayerDetails(bestFriend, hyPlayerData -> { - if (hyPlayerData != null && hyPlayerData.getLastLogin() > hyPlayerData.getLastLogout()) { + if (hyPlayerData != null && !hyPlayerData.hasNeverLoggedOut() && hyPlayerData.getLastLogin() > hyPlayerData.getLastLogout()) { // online & not hiding their online status main.getPlayerCache().addBestFriend(bestFriend.getName()); -- cgit