public abstract class AbstractSessionManager extends java.lang.Object implements SessionManager
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractSessionManager.CacheKey |
| Modifier and Type | Field and Description |
|---|---|
static int |
RUN_DELAY |
static long |
SESSION_LIFETIME |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSessionManager() |
| Modifier and Type | Method and Description |
|---|---|
Session |
createSession(LocalPlayer player)
Create a session for a player.
|
Session |
get(LocalPlayer player)
Get a player's session.
|
Session |
getIfPresent(LocalPlayer player)
Get a player's session, if one exists.
|
boolean |
hasBypass(LocalPlayer player,
com.sk89q.worldedit.world.World world)
Check whether a player has the region bypass permission.
|
boolean |
registerHandler(Handler.Factory<? extends Handler> factory,
Handler.Factory<? extends Handler> after)
Register a handler with the BukkitSessionManager.
|
void |
resetState(LocalPlayer player)
Re-initialize handlers and clear "last position," "last state," etc.
|
boolean |
unregisterHandler(Handler.Factory<? extends Handler> factory)
Unregister a handler.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitresetAllStatespublic static final int RUN_DELAY
public static final long SESSION_LIFETIME
public boolean registerHandler(Handler.Factory<? extends Handler> factory, @Nullable Handler.Factory<? extends Handler> after)
SessionManagerregisterHandler in interface SessionManagerfactory - a factory which takes a session and returns an instance of your handlerafter - the handler factory to insert the first handler after, to ensure a specific order when creating new sessionstrue (as specified by Collection.add(E))
false if after is not registered, or factory is nullpublic boolean unregisterHandler(Handler.Factory<? extends Handler> factory)
SessionManagerunregisterHandler in interface SessionManagerfactory - the handler factory to unregisterpublic boolean hasBypass(LocalPlayer player, com.sk89q.worldedit.world.World world)
SessionManagerThe return value may be cached for a few seconds.
hasBypass in interface SessionManagerplayer - The playerworld - The worldpublic void resetState(LocalPlayer player)
SessionManagerresetState in interface SessionManagerplayer - The player@Nullable public Session getIfPresent(LocalPlayer player)
SessionManagergetIfPresent in interface SessionManagerplayer - The playerpublic Session get(LocalPlayer player)
SessionManagerThis method can only be called from the main thread. While the session manager itself is thread-safe, some of the handlers may require initialization that requires the server main thread.
get in interface SessionManagerplayer - The player to get a session forplayer's sessionpublic Session createSession(LocalPlayer player)
SessionManagercreateSession in interface SessionManagerplayer - The player