mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08: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.
|
||||
*/
|
||||
public Optional<Session> cacheSession(UUID playerUUID, Session session) {
|
||||
Optional<Session> 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user