Package com.sk89q.worldedit.session
Class SessionManager
java.lang.Object
com.sk89q.worldedit.session.SessionManager
Session manager for WorldEdit.
Get a reference to one from WorldEdit
.
While this class is thread-safe, the returned session may not be.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all sessions.boolean
contains
(SessionOwner owner) Get whether a session exists for the given owner.findByName
(String name) Find a session by its name specified bySessionKey.getName()
.get
(SessionOwner owner) Get the session for an owner and create one if one doesn't exist.getIfPresent
(SessionOwner owner) Gets the session for an owner and return it if it exists, otherwise returnnull
.protected UUID
getKey
(SessionKey key) Get the key to use in the map for aSessionKey
.protected UUID
getKey
(SessionOwner owner) Get the key to use in the map for an owner.void
void
onSessionIdle
(SessionIdleEvent event) void
remove
(SessionOwner owner) Remove the session for the given owner if one exists.void
unload()
Called to unload this session manager.
-
Field Details
-
EXPIRATION_GRACE
public static int EXPIRATION_GRACE
-
-
Constructor Details
-
SessionManager
Create a new session manager.- Parameters:
worldEdit
- a WorldEdit instance
-
-
Method Details
-
contains
Get whether a session exists for the given owner.- Parameters:
owner
- the owner- Returns:
- true if a session exists
-
findByName
Find a session by its name specified bySessionKey.getName()
.- Parameters:
name
- the name- Returns:
- the session, if found, otherwise
null
-
getIfPresent
Gets the session for an owner and return it if it exists, otherwise returnnull
.- Parameters:
owner
- the owner- Returns:
- the session for the owner, if it exists
-
get
Get the session for an owner and create one if one doesn't exist.- Parameters:
owner
- the owner- Returns:
- a session
-
getKey
Get the key to use in the map for an owner.- Parameters:
owner
- the owner- Returns:
- the key object
-
getKey
Get the key to use in the map for aSessionKey
.- Parameters:
key
- the session key object- Returns:
- the key object
-
remove
Remove the session for the given owner if one exists.- Parameters:
owner
- the owner
-
unload
public void unload()Called to unload this session manager. -
clear
public void clear()Remove all sessions. -
onConfigurationLoad
-
onSessionIdle
-