mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-03 09:21:41 +01:00
Fixed player online indicator on Bungee/Velocity
This commit is contained in:
parent
0c92fbbaa2
commit
7f2ad68014
@ -71,11 +71,12 @@ public class SessionCache {
|
|||||||
* @return Optional: previous session. Recipients of this object should decide if it needs to be saved.
|
* @return Optional: previous session. Recipients of this object should decide if it needs to be saved.
|
||||||
*/
|
*/
|
||||||
public Optional<Session> cacheSession(UUID playerUUID, Session session) {
|
public Optional<Session> cacheSession(UUID playerUUID, Session session) {
|
||||||
|
Optional<Session> inProgress = Optional.empty();
|
||||||
if (getCachedSession(playerUUID).isPresent()) {
|
if (getCachedSession(playerUUID).isPresent()) {
|
||||||
return endSession(playerUUID, session.getUnsafe(SessionKeys.START));
|
inProgress = endSession(playerUUID, session.getUnsafe(SessionKeys.START));
|
||||||
}
|
}
|
||||||
ACTIVE_SESSIONS.put(playerUUID, session);
|
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) {
|
if (session == null || session.getUnsafe(SessionKeys.START) > time) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
removeSessionFromCache(playerUUID);
|
ACTIVE_SESSIONS.remove(playerUUID);
|
||||||
session.endSession(time);
|
session.endSession(time);
|
||||||
return Optional.of(session);
|
return Optional.of(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeSessionFromCache(UUID playerUUID) {
|
|
||||||
ACTIVE_SESSIONS.remove(playerUUID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user