Class SessionManager

java.lang.Object
com.sk89q.worldedit.session.SessionManager

public class SessionManager extends Object
Session manager for WorldEdit.

Get a reference to one from WorldEdit.

While this class is thread-safe, the returned session may not be.

  • Field Details

    • EXPIRATION_GRACE

      public static int EXPIRATION_GRACE
  • Constructor Details

    • SessionManager

      public SessionManager(WorldEdit worldEdit)
      Create a new session manager.
      Parameters:
      worldEdit - a WorldEdit instance
  • Method Details

    • contains

      public boolean contains(SessionOwner owner)
      Get whether a session exists for the given owner.
      Parameters:
      owner - the owner
      Returns:
      true if a session exists
    • findByName

      @Nullable public LocalSession findByName(String name)
      Find a session by its name specified by SessionKey.getName().
      Parameters:
      name - the name
      Returns:
      the session, if found, otherwise null
    • getIfPresent

      @Nullable public LocalSession getIfPresent(SessionOwner owner)
      Gets the session for an owner and return it if it exists, otherwise return null.
      Parameters:
      owner - the owner
      Returns:
      the session for the owner, if it exists
    • get

      public LocalSession get(SessionOwner owner)
      Get the session for an owner and create one if one doesn't exist.
      Parameters:
      owner - the owner
      Returns:
      a session
    • getKey

      protected UUID getKey(SessionOwner owner)
      Get the key to use in the map for an owner.
      Parameters:
      owner - the owner
      Returns:
      the key object
    • getKey

      protected UUID getKey(SessionKey key)
      Get the key to use in the map for a SessionKey.
      Parameters:
      key - the session key object
      Returns:
      the key object
    • remove

      public void remove(SessionOwner owner)
      Remove the session for the given owner if one exists.
      Parameters:
      owner - the owner
    • unload

      public void unload()
      Called to unload this session manager.
    • clear

      public void clear()
      Remove all sessions.
    • onConfigurationLoad

      public void onConfigurationLoad(ConfigurationLoadEvent event)
    • onSessionIdle

      public void onSessionIdle(SessionIdleEvent event)