Class Session

java.lang.Object
com.sk89q.worldguard.session.Session

public class Session extends Object
Keeps session information on a player.
  • Constructor Details

    • Session

      public Session(SessionManager manager)
      Create a new session.
      Parameters:
      manager - The session manager
  • Method Details

    • register

      public void register(Handler handler)
      Register a new handler.
      Parameters:
      handler - A new handler
    • getManager

      public SessionManager getManager()
      Get the session manager.
      Returns:
      The session manager
    • getHandler

      @Nullable public <T extends Handler> T getHandler(Class<T> type)
      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

      public void initialize(LocalPlayer player)
      Initialize the session.
      Parameters:
      player - The player
    • uninitialize

      public void uninitialize(LocalPlayer player)
      Uninitialize the session.
      Parameters:
      player - The player
    • tick

      public void tick(LocalPlayer player)
      Tick the session.
      Parameters:
      player - The player
    • resetState

      public void resetState(LocalPlayer player)
      Re-initialize the session.
      Parameters:
      player - The player
    • isInvincible

      public boolean isInvincible(LocalPlayer player)
      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 player
      to - The new location
      moveType - 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 player
      to - The new location
      moveType - The type of move
      forced - 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