Class ServerConfigurationConnectionEvents

java.lang.Object
net.fabricmc.fabric.api.networking.v1.ServerConfigurationConnectionEvents

public final class ServerConfigurationConnectionEvents extends Object
Offers access to events related to the connection to a client on a logical server while a client is configuring.
  • Field Details

    • BEFORE_CONFIGURE

      public static final Event<ServerConfigurationConnectionEvents.Configure> 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

      public static final Event<ServerConfigurationConnectionEvents.Configure> CONFIGURE
      Event fired during vanilla configuration.

      This event is executed on netty's event loops.

      An example usage of this:

      
       ServerConfigurationConnectionEvents.CONFIGURE.register((handler, server) -> {
       	if (ServerConfigurationNetworking.canSend(handler, ConfigurationPacket.PACKET_TYPE)) {
        handler.addTask(new TestConfigurationTask("Example data"));
       	} else {
       	  // You can opt to disconnect the client if it cannot handle the configuration task
       	  handler.disconnect(Text.literal("Network test configuration not supported by client"));
       	  }
       });
       
    • DISCONNECT

      public static final Event<ServerConfigurationConnectionEvents.Disconnect> DISCONNECT
      An event for the disconnection of the server configuration network handler.

      No packets should be sent when this event is invoked.