register Receiver
static boolean registerReceiver(ServerPlayNetworkHandler networkHandler, Identifier channelName, ServerPlayNetworking.PlayChannelHandler channelHandler)
Content copied to clipboard
Registers a handler to a channel.This method differs from registerGlobalReceiver sincethe channel handler will only be applied to the player represented by the ServerPlayNetworkHandler.
For example, if you only register a receiver using this method when a registerGlobalReceiver login response has been received, you should use INIT to register the channel handler.
If a handler is already registered to the {@code channelName}
, this method will return {@code false}
, and no change will be made.Use unregisterReceiver to unregister the existing handler.
Return
false if a handler is already registered to the channel name
See also
net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents
ServerPlayConnectionEvents#INIT
Parameters
networkHandler
the handler
channelName
the id of the channel
channelHandler
the handler
Sources
jvm source
Link copied to clipboard