From 7f2ad68014ca9ddd1066196399b72c4310f4afa5 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Thu, 26 Sep 2019 10:25:15 +0300 Subject: [PATCH] Fixed player online indicator on Bungee/Velocity --- .../djrapitops/plan/gathering/cache/SessionCache.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/gathering/cache/SessionCache.java b/Plan/common/src/main/java/com/djrapitops/plan/gathering/cache/SessionCache.java index 5558339e5..822b3fea8 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/gathering/cache/SessionCache.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/gathering/cache/SessionCache.java @@ -71,11 +71,12 @@ public class SessionCache { * @return Optional: previous session. Recipients of this object should decide if it needs to be saved. */ public Optional cacheSession(UUID playerUUID, Session session) { + Optional inProgress = Optional.empty(); if (getCachedSession(playerUUID).isPresent()) { - return endSession(playerUUID, session.getUnsafe(SessionKeys.START)); + inProgress = endSession(playerUUID, session.getUnsafe(SessionKeys.START)); } ACTIVE_SESSIONS.put(playerUUID, session); - return Optional.empty(); + return inProgress; } /** @@ -90,12 +91,8 @@ public class SessionCache { if (session == null || session.getUnsafe(SessionKeys.START) > time) { return Optional.empty(); } - removeSessionFromCache(playerUUID); + ACTIVE_SESSIONS.remove(playerUUID); session.endSession(time); return Optional.of(session); } - - protected void removeSessionFromCache(UUID playerUUID) { - ACTIVE_SESSIONS.remove(playerUUID); - } }