From 5c60558422cd05905f50a44c410325a14d63736a Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Fri, 6 Apr 2018 10:21:00 +0300 Subject: [PATCH] Made ActivityIndex use Active playtime instead of time with AFK #538 --- .../main/java/com/djrapitops/plan/data/PlayerProfile.java | 4 ++++ .../com/djrapitops/plan/data/calculation/ActivityIndex.java | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java b/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java index 7ee8a0517..999404cf5 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/PlayerProfile.java @@ -438,6 +438,10 @@ public class PlayerProfile { return sessions.mapToLong(Session::getAfkLength).sum(); } + public static long getActivePlaytime(Stream sessions) { + return sessions.mapToLong(Session::getActiveLength).sum(); + } + public void calculateWorldTimesPerServer() { if (worldTimesMap.containsKey(ServerInfo.getServerUUID())) { return; diff --git a/Plan/src/main/java/com/djrapitops/plan/data/calculation/ActivityIndex.java b/Plan/src/main/java/com/djrapitops/plan/data/calculation/ActivityIndex.java index 9b26a6ce8..eac36855c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/calculation/ActivityIndex.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/calculation/ActivityIndex.java @@ -45,17 +45,17 @@ public class ActivityIndex { // Playtime per week multipliers, max out to avoid too high values. double max = 4.0; - long playtimeWeek = PlayerProfile.getPlaytime(sessionsWeek.stream()); + long playtimeWeek = PlayerProfile.getActivePlaytime(sessionsWeek.stream()); double weekPlay = (playtimeWeek * 1.0 / activePlayThreshold); if (weekPlay > max) { weekPlay = max; } - long playtimeWeek2 = PlayerProfile.getPlaytime(sessionsWeek2.stream()); + long playtimeWeek2 = PlayerProfile.getActivePlaytime(sessionsWeek2.stream()); double week2Play = (playtimeWeek2 * 1.0 / activePlayThreshold); if (week2Play > max) { week2Play = max; } - long playtimeWeek3 = PlayerProfile.getPlaytime(sessionsWeek3.stream()); + long playtimeWeek3 = PlayerProfile.getActivePlaytime(sessionsWeek3.stream()); double week3Play = (playtimeWeek3 * 1.0 / activePlayThreshold); if (week3Play > max) { week3Play = max;