Class SessionLoginEvent

java.lang.Object
org.geysermc.geyser.api.event.connection.ConnectionEvent
org.geysermc.geyser.api.event.bedrock.SessionLoginEvent
All Implemented Interfaces:
org.geysermc.event.Cancellable, org.geysermc.event.Event

public final class SessionLoginEvent extends ConnectionEvent implements org.geysermc.event.Cancellable
Called when a session has logged in, and is about to connect to a remote Java server. This event is cancellable, and can be used to prevent the player from connecting to the remote server.
  • Constructor Details

  • Method Details

    • isCancelled

      public boolean isCancelled()
      Returns whether the event is cancelled.
      Specified by:
      isCancelled in interface org.geysermc.event.Cancellable
      Returns:
      The cancel status of the event.
    • setCancelled

      public void setCancelled(boolean cancelled)
      Cancels the login event, and disconnects the player. If cancelled, the player disconnects without connecting to the remote server. This method will use a default disconnect reason. To specify one, use setCancelled(boolean, String).
      Specified by:
      setCancelled in interface org.geysermc.event.Cancellable
      Parameters:
      cancelled - If the login event should be cancelled.
    • setCancelled

      public void setCancelled(boolean cancelled, @NonNull String disconnectReason)
      Cancels the login event, and disconnects the player with the specified reason. If cancelled, the player disconnects without connecting to the remote server.
      Parameters:
      cancelled - If the login event should be cancelled.
      disconnectReason - The reason for the cancellation.
    • disconnectReason

      public @Nullable String disconnectReason()
      Returns the reason for the cancellation, or null if there is no reason given.
      Returns:
      The reason for the cancellation.
    • remoteServer

      public @NonNull RemoteServer remoteServer()
      Gets the RemoteServer the session will attempt to connect to.
      Returns:
      the RemoteServer the session will attempt to connect to.
    • remoteServer

      public void remoteServer(@NonNull RemoteServer remoteServer)
      Sets the RemoteServer to connect the session to. This method will only work as expected on PlatformType.STANDALONE, as on other Geyser platforms, the remote server is not determined by Geyser.
      Parameters:
      remoteServer - Sets the RemoteServer to connect to.
    • cookies

      public void cookies(@NonNull Map<String,byte[]> cookies)
      Sets a map of cookies from a possible previous session. The Java server can send and request these to store information on the client across server transfers.
    • cookies

      public @NonNull Map<String,byte[]> cookies()
      Gets a map of the sessions cookies, if set.
      Returns:
      the connections cookies
    • transferring

      public void transferring(boolean transferring)
      Determines the connection intent of the connection
    • transferring

      public boolean transferring()
      Gets whether this login attempt to the Java server has the transfer intent