public class SessionManager
extends java.lang.Object
Get a reference to one from WorldEdit
.
While this class is thread-safe, the returned session may not be.
Modifier and Type | Field and Description |
---|---|
static int |
EXPIRATION_GRACE |
Constructor and Description |
---|
SessionManager(WorldEdit worldEdit)
Create a new session manager.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all sessions.
|
boolean |
contains(SessionOwner owner)
Get whether a session exists for the given owner.
|
LocalSession |
findByName(java.lang.String name)
Find a session by its name specified by
SessionKey.getName() . |
LocalSession |
get(SessionOwner owner)
Get the session for an owner and create one if one doesn't exist.
|
LocalSession |
getIfPresent(SessionOwner owner)
Gets the session for an owner and return it if it exists, otherwise
return
null . |
protected java.util.UUID |
getKey(SessionKey key)
Get the key to use in the map for a
SessionKey . |
protected java.util.UUID |
getKey(SessionOwner owner)
Get the key to use in the map for an owner.
|
void |
onConfigurationLoad(ConfigurationLoadEvent event) |
void |
remove(SessionOwner owner)
Remove the session for the given owner if one exists.
|
void |
unload()
Called to unload this session manager.
|
public SessionManager(WorldEdit worldEdit)
worldEdit
- a WorldEdit instancepublic boolean contains(SessionOwner owner)
owner
- the owner@Nullable public LocalSession findByName(java.lang.String name)
SessionKey.getName()
.name
- the namenull
@Nullable public LocalSession getIfPresent(SessionOwner owner)
null
.owner
- the ownerpublic LocalSession get(SessionOwner owner)
owner
- the ownerprotected java.util.UUID getKey(SessionOwner owner)
owner
- the ownerprotected java.util.UUID getKey(SessionKey key)
SessionKey
.key
- the session key objectpublic void remove(SessionOwner owner)
owner
- the ownerpublic void unload()
public void clear()
public void onConfigurationLoad(ConfigurationLoadEvent event)