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) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the reason for the cancellation, or null if there is no reason given.booleanReturns whether the event is cancelled.@NonNull RemoteServerGets theRemoteServerthe section 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.Methods inherited from class org.geysermc.geyser.api.event.connection.ConnectionEvent
connection
-
Constructor Details
-
SessionLoginEvent
-
-
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 section will attempt to connect to.- Returns:
- the
RemoteServerthe section will attempt to connect to.
-
remoteServer
Sets theRemoteServerto connect the session to.- Parameters:
remoteServer- Sets theRemoteServerto connect to.
-