public class Session
extends java.lang.Object
| Constructor and Description |
|---|
Session(SessionManager manager)
Create a new session.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Handler> |
getHandler(java.lang.Class<T> type)
Get a handler by class, if has been registered.
|
SessionManager |
getManager()
Get the session manager.
|
boolean |
hasBypassDisabled() |
void |
initialize(LocalPlayer player)
Initialize the session.
|
boolean |
isInvincible(LocalPlayer player)
Test whether the session has invincibility enabled.
|
void |
register(Handler handler)
Register a new handler.
|
void |
resetState(LocalPlayer player)
Re-initialize the session.
|
void |
setBypassDisabled(boolean disabled)
Toggle bypass disabling for this session.
|
com.sk89q.worldedit.util.Location |
testMoveTo(LocalPlayer player,
com.sk89q.worldedit.util.Location to,
MoveType moveType)
Test movement to the given location.
|
com.sk89q.worldedit.util.Location |
testMoveTo(LocalPlayer player,
com.sk89q.worldedit.util.Location to,
MoveType moveType,
boolean forced)
Test movement to the given location.
|
void |
tick(LocalPlayer player)
Tick the session.
|
public Session(SessionManager manager)
manager - The session managerpublic void register(Handler handler)
handler - A new handlerpublic SessionManager getManager()
@Nullable public <T extends Handler> T getHandler(java.lang.Class<T> type)
T - The type of handlertype - The type of handlerpublic void initialize(LocalPlayer player)
player - The playerpublic void tick(LocalPlayer player)
player - The playerpublic void resetState(LocalPlayer player)
player - The playerpublic boolean isInvincible(LocalPlayer player)
@Nullable public com.sk89q.worldedit.util.Location testMoveTo(LocalPlayer player, com.sk89q.worldedit.util.Location to, MoveType moveType)
player - The playerto - The new locationmoveType - The type of moveFor an explanation@Nullable public com.sk89q.worldedit.util.Location testMoveTo(LocalPlayer player, com.sk89q.worldedit.util.Location to, MoveType moveType, boolean forced)
If a non-null Location is returned, the player should be
at that location instead of where the player has tried to move to.
If the moveType is cancellable
(MoveType.isCancellable(), then the last valid location will
be set to the given one.
player - The playerto - The new locationmoveType - The type of moveforced - Whether to force a checkpublic boolean hasBypassDisabled()
public void setBypassDisabled(boolean disabled)
disabled - true to disable region bypass