Package com.sk89q.worldguard.session
Class Session
java.lang.Object
com.sk89q.worldguard.session.Session
Keeps session information on a player.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Handler>
TgetHandler
(Class<T> type) Get a handler by class, if has been registered.Get the session manager.boolean
void
initialize
(LocalPlayer player) Initialize the session.boolean
isInvincible
(LocalPlayer player) Test whether the session has invincibility enabled.void
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.void
uninitialize
(LocalPlayer player) Uninitialize the session.
-
Constructor Details
-
Session
Create a new session.- Parameters:
manager
- The session manager
-
-
Method Details
-
register
Register a new handler.- Parameters:
handler
- A new handler
-
getManager
Get the session manager.- Returns:
- The session manager
-
getHandler
Get a handler by class, if has been registered.- Type Parameters:
T
- The type of handler- Parameters:
type
- The type of handler- Returns:
- A handler instance, otherwise null
-
initialize
Initialize the session.- Parameters:
player
- The player
-
uninitialize
Uninitialize the session.- Parameters:
player
- The player
-
tick
Tick the session.- Parameters:
player
- The player
-
resetState
Re-initialize the session.- Parameters:
player
- The player
-
isInvincible
Test whether the session has invincibility enabled.- Returns:
- Whether invincibility is enabled
-
testMoveTo
@Nullable public com.sk89q.worldedit.util.Location testMoveTo(LocalPlayer player, com.sk89q.worldedit.util.Location to, MoveType moveType) Test movement to the given location.- Parameters:
player
- The playerto
- The new locationmoveType
- The type of move- Returns:
- The overridden location, if the location is being overridden
- See Also:
-
testMoveTo
@Nullable public com.sk89q.worldedit.util.Location testMoveTo(LocalPlayer player, com.sk89q.worldedit.util.Location to, MoveType moveType, boolean forced) Test movement to the given location.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.- Parameters:
player
- The playerto
- The new locationmoveType
- The type of moveforced
- Whether to force a check- Returns:
- The overridden location, if the location is being overridden
-
hasBypassDisabled
public boolean hasBypassDisabled()- Returns:
- true if the owner of this session should not bypass protection, even if they have bypass permissions
-
setBypassDisabled
public void setBypassDisabled(boolean disabled) Toggle bypass disabling for this session.- Parameters:
disabled
- true to disable region bypass
-