Class ServerLoginNetworkAddon
java.lang.Object
net.fabricmc.fabric.impl.networking.AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
net.fabricmc.fabric.impl.networking.server.ServerLoginNetworkAddon
- All Implemented Interfaces:
LoginPacketSender, PacketSender
public final class ServerLoginNetworkAddon
extends AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
implements LoginPacketSender
-
Field Summary
Fields inherited from class AbstractNetworkAddon
logger, receiver -
Constructor Summary
ConstructorsConstructorDescriptionServerLoginNetworkAddon(net.minecraft.server.network.ServerLoginPacketListenerImpl listener) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.network.protocol.Packet<?> createPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload packet) Creates a packet from a packet payload.net.minecraft.network.protocol.Packet<?> createPacket(net.minecraft.resources.Identifier channelName, net.minecraft.network.FriendlyByteBuf buf) Creates a packet for sending to a login channel.voiddisconnect(net.minecraft.network.chat.Component disconnectReason) Disconnects the player.booleanhandle(net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket packet) Handles an incoming query response during login.protected voidhandleRegistration(net.minecraft.resources.Identifier channelName) protected voidhandleUnregistration(net.minecraft.resources.Identifier channelName) protected voidprotected voidprotected booleanisReservedChannel(net.minecraft.resources.Identifier channelName) Checks if a channel is considered a "reserved" channel.booleanvoidregisterOutgoingPacket(net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet) voidsendPacket(net.minecraft.network.protocol.Packet<?> packet, io.netty.channel.ChannelFutureListener callback) Sends a packet.Methods inherited from class AbstractNetworkAddon
endSession, getHandler, getReceivableChannels, handleDisconnect, lateInit, registerChannel, registerChannels, unregisterChannelMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LoginPacketSender
sendPacket, sendPacketMethods inherited from interface PacketSender
sendPacket, sendPacket, sendPacket
-
Constructor Details
-
ServerLoginNetworkAddon
public ServerLoginNetworkAddon(net.minecraft.server.network.ServerLoginPacketListenerImpl listener)
-
-
Method Details
-
invokeInitEvent
protected void invokeInitEvent()- Specified by:
invokeInitEventin classAbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
-
queryTick
public boolean queryTick() -
handle
public boolean handle(net.minecraft.network.protocol.login.ServerboundCustomQueryAnswerPacket packet) Handles an incoming query response during login.- Parameters:
packet- the packet to handle- Returns:
- true if the packet was handled
-
createPacket
public net.minecraft.network.protocol.Packet<?> createPacket(net.minecraft.network.protocol.common.custom.CustomPacketPayload packet) Description copied from interface:PacketSenderCreates a packet from a packet payload.- Specified by:
createPacketin interfacePacketSender- Parameters:
packet- the packet payload
-
createPacket
public net.minecraft.network.protocol.Packet<?> createPacket(net.minecraft.resources.Identifier channelName, net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:LoginPacketSenderCreates a packet for sending to a login channel.- Specified by:
createPacketin interfaceLoginPacketSender- Parameters:
channelName- the id of the channelbuf- the content of the packet- Returns:
- the created packet
-
sendPacket
public void sendPacket(net.minecraft.network.protocol.Packet<?> packet, io.netty.channel.ChannelFutureListener callback) Description copied from interface:PacketSenderSends a packet.- Specified by:
sendPacketin interfacePacketSender- Parameters:
packet- the packetcallback- an optional callback to execute after the packet is sent, may benull.
-
disconnect
public void disconnect(net.minecraft.network.chat.Component disconnectReason) Description copied from interface:PacketSenderDisconnects the player.- Specified by:
disconnectin interfacePacketSender- Parameters:
disconnectReason- the reason for disconnection
-
registerOutgoingPacket
public void registerOutgoingPacket(net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet) -
handleRegistration
protected void handleRegistration(net.minecraft.resources.Identifier channelName) - Specified by:
handleRegistrationin classAbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
-
handleUnregistration
protected void handleUnregistration(net.minecraft.resources.Identifier channelName) - Specified by:
handleUnregistrationin classAbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
-
invokeDisconnectEvent
protected void invokeDisconnectEvent()- Specified by:
invokeDisconnectEventin classAbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
-
isReservedChannel
protected boolean isReservedChannel(net.minecraft.resources.Identifier channelName) Description copied from class:AbstractNetworkAddonChecks if a channel is considered a "reserved" channel. A reserved channel such as "minecraft:(un)register" has special handling and should not have any channel handlers registered for it.- Specified by:
isReservedChannelin classAbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>- Parameters:
channelName- the channel name- Returns:
- whether the channel is reserved
-