Class ServerConfigurationConnectionEvents
java.lang.Object
net.fabricmc.fabric.api.networking.v1.ServerConfigurationConnectionEvents
Offers access to events related to the connection to a client on a logical server while a client is configuring.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Event<ServerConfigurationConnectionEvents.Configure> Event fired before any vanilla configuration has taken place.static final Event<ServerConfigurationConnectionEvents.Configure> Event fired during vanilla configuration.static final Event<ServerConfigurationConnectionEvents.Disconnect> An event for the disconnection of the server configuration packet listener. -
Method Summary
-
Field Details
-
BEFORE_CONFIGURE
Event fired before any vanilla configuration has taken place.This event is executed on netty's event loops.
Task queued during this event will complete before vanilla configuration starts.
-
CONFIGURE
Event fired during vanilla configuration.This event is executed on netty's event loops.
An example usage of this:
ServerConfigurationConnectionEvents.CONFIGURE.register((listener, server) -> { if (ServerConfigurationNetworking.canSend(listener, ConfigurationPacket.PACKET_TYPE)) { listener.addTask(new TestConfigurationTask("Example data")); } else { // You can opt to disconnect the client if it cannot handle the configuration task listener.disconnect(Component.literal("Network test configuration not supported by client")); } }); -
DISCONNECT
An event for the disconnection of the server configuration packet listener.No packets should be sent when this event is invoked.
-