Class ActiveSessionProvider
java.lang.Object
de.murmelmeister.murmelapi.logging.ActiveSessionProvider
- All Implemented Interfaces:
ActiveSession
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseSession(int userId) Closes the active session associated with the specified user ID.booleanexistsSession(int userId) Checks whether a session exists for the specified user ID.getClientVersion(int userId) Retrieves the client version associated with the specified user ID.getIpAddress(int userId) Retrieves the current IP address associated with a specific user.getLoginTime(int userId) Retrieves the timestamp of the user's login time for the active session.getProtocolVersion(int userId) Retrieves the protocol version associated with a specific user based on their user ID.getSessionId(int userId) Retrieves the session ID associated with the specified user.booleanisOnline(int userId) Checks if the user with the specified user ID is currently online.static voidvoidstartSession(int userId, InetAddress inetAddress, String clientVersion, String protocolVersion) Creates a new session for the specified user with the provided details.
-
Constructor Details
-
ActiveSessionProvider
-
-
Method Details
-
setup
-
existsSession
public boolean existsSession(int userId) Description copied from interface:ActiveSessionChecks whether a session exists for the specified user ID.- Specified by:
existsSessionin interfaceActiveSession- Parameters:
userId- The unique identifier of the user whose session existence is to be checked.- Returns:
- true if a session exists for the specified user ID, false otherwise.
-
startSession
public void startSession(int userId, InetAddress inetAddress, String clientVersion, String protocolVersion) Description copied from interface:ActiveSessionCreates a new session for the specified user with the provided details.- Specified by:
startSessionin interfaceActiveSession- Parameters:
userId- The unique identifier of the user for whom the session is being created.inetAddress- The IP address of the user's device initiating the session.clientVersion- The version of the client used by the user.protocolVersion- The protocol version used by the client to communicate.
-
closeSession
public void closeSession(int userId) Description copied from interface:ActiveSessionCloses the active session associated with the specified user ID. And create a new login entry in the login history.- Specified by:
closeSessionin interfaceActiveSession- Parameters:
userId- The unique identifier of the user whose session is to be closed.
-
getSessionId
Description copied from interface:ActiveSessionRetrieves the session ID associated with the specified user.- Specified by:
getSessionIdin interfaceActiveSession- Parameters:
userId- The unique identifier of the user whose session ID is to be retrieved.- Returns:
- The UUID representing the session ID for the specified user, or null if no session exists.
-
getIpAddress
Description copied from interface:ActiveSessionRetrieves the current IP address associated with a specific user.- Specified by:
getIpAddressin interfaceActiveSession- Parameters:
userId- The unique identifier of the user whose current IP address is being retrieved.- Returns:
- The current IP address as a
Stringfor the specified user, ornullif no IP address is found.
-
getLoginTime
Description copied from interface:ActiveSessionRetrieves the timestamp of the user's login time for the active session.- Specified by:
getLoginTimein interfaceActiveSession- Parameters:
userId- The unique identifier of the user whose login time is to be retrieved.- Returns:
- A
Timestampobject representing the user's login time, ornullif no active session exists for the specified user.
-
getClientVersion
Description copied from interface:ActiveSessionRetrieves the client version associated with the specified user ID.- Specified by:
getClientVersionin interfaceActiveSession- Parameters:
userId- The unique identifier of the user whose client version is to be retrieved.- Returns:
- The client version as a string, or null if no client version is associated with the given user ID.
-
getProtocolVersion
Description copied from interface:ActiveSessionRetrieves the protocol version associated with a specific user based on their user ID.- Specified by:
getProtocolVersionin interfaceActiveSession- Parameters:
userId- The unique identifier of the user.- Returns:
- The protocol version as a string, or null if no protocol version is associated with the user.
-
isOnline
public boolean isOnline(int userId) Description copied from interface:ActiveSessionChecks if the user with the specified user ID is currently online.- Specified by:
isOnlinein interfaceActiveSession- Parameters:
userId- The unique identifier of the user to check.- Returns:
- true if the user is online, false otherwise.
-