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 Summary
ConstructorsConstructorDescriptionSessionLoginEvent(@NonNull GeyserConnection connection, @NonNull RemoteServer remoteServer, @NonNull Map<String, byte[]> cookies) -
Method Summary
Modifier and TypeMethodDescriptioncookies()Gets a map of the sessions cookies, if set.voidSets a map of cookies from a possible previous session.@Nullable StringReturns the reason for the cancellation, or null if there is no reason given.booleanReturns whether the event is cancelled.@NonNull RemoteServerGets theRemoteServerthe session will attempt to connect to.voidremoteServer(@NonNull RemoteServer remoteServer) Sets theRemoteServerto connect the session to.voidsetCancelled(boolean cancelled) Cancels the login event, and disconnects the player.voidsetCancelled(boolean cancelled, @NonNull String disconnectReason) Cancels the login event, and disconnects the player with the specified reason.booleanGets whether this login attempt to the Java server has the transfer intentvoidtransferring(boolean transferring) Determines the connection intent of the connectionMethods inherited from class org.geysermc.geyser.api.event.connection.ConnectionEvent
connection
-
Constructor Details
-
SessionLoginEvent
public SessionLoginEvent(@NonNull GeyserConnection connection, @NonNull RemoteServer remoteServer, @NonNull Map<String, byte[]> cookies)
-
-
Method Details
-
isCancelled
public boolean isCancelled()Returns whether the event is cancelled.- Specified by:
isCancelledin interfaceorg.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, usesetCancelled(boolean, String).- Specified by:
setCancelledin interfaceorg.geysermc.event.Cancellable- Parameters:
cancelled- If the login event should be cancelled.
-
setCancelled
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
Returns the reason for the cancellation, or null if there is no reason given.- Returns:
- The reason for the cancellation.
-
remoteServer
Gets theRemoteServerthe session will attempt to connect to.- Returns:
- the
RemoteServerthe session will attempt to connect to.
-
remoteServer
Sets theRemoteServerto connect the session to.- Parameters:
remoteServer- Sets theRemoteServerto connect to.
-
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
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
-