Class SessionDefineNetworkChannelsEvent

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

public abstract class SessionDefineNetworkChannelsEvent extends ConnectionEvent
Called whenever Geyser is registering network channels.

It is important to note that this event may be called multiple times during a session's lifecycle, as channels can be registered at different stages of the connection. It is always important to check the SessionDefineNetworkChannelsEvent.State of the connection through state() before registering channels to avoid creating multiple listeners that are only intended to be registered once.

It is typically advised to register channels at the SessionDefineNetworkChannelsEvent.State.LOGGED_IN state unless creating a developer tool, such as a packet logger. This is the latest point at which channels can be registered, and is when clients will be fully established. Registering earlier means certain client information is unavailable or potentially unverified (i.e., Bedrock usernames).

Registering at earlier points also increases the intensity of an L7 attack as the client is in a far earlier stage of the connection and therefore more vulnerable to invalid clients early in the connection stage. However, for debug tools that will never be used in a production environment, registering at earlier stages can be useful to capture more information about the connection and the client's behavior during earlier stages of the connection.

Since:
2.9.2