Class ServerLoginNetworkAddon

All Implemented Interfaces:
LoginPacketSender, PacketSender

public final class ServerLoginNetworkAddon extends AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler> implements LoginPacketSender
  • Constructor Details

    • ServerLoginNetworkAddon

      public ServerLoginNetworkAddon(net.minecraft.server.network.ServerLoginPacketListenerImpl listener)
  • Method Details

    • invokeInitEvent

      protected void invokeInitEvent()
      Specified by:
      invokeInitEvent in class AbstractNetworkAddon<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: PacketSender
      Creates a packet from a packet payload.
      Specified by:
      createPacket in interface PacketSender
      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: LoginPacketSender
      Creates a packet for sending to a login channel.
      Specified by:
      createPacket in interface LoginPacketSender
      Parameters:
      channelName - the id of the channel
      buf - 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: PacketSender
      Sends a packet.
      Specified by:
      sendPacket in interface PacketSender
      Parameters:
      packet - the packet
      callback - an optional callback to execute after the packet is sent, may be null.
    • disconnect

      public void disconnect(net.minecraft.network.chat.Component disconnectReason)
      Description copied from interface: PacketSender
      Disconnects the player.
      Specified by:
      disconnect in interface PacketSender
      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:
      handleRegistration in class AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
    • handleUnregistration

      protected void handleUnregistration(net.minecraft.resources.Identifier channelName)
      Specified by:
      handleUnregistration in class AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
    • invokeDisconnectEvent

      protected void invokeDisconnectEvent()
      Specified by:
      invokeDisconnectEvent in class AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
    • isReservedChannel

      protected boolean isReservedChannel(net.minecraft.resources.Identifier channelName)
      Description copied from class: AbstractNetworkAddon
      Checks 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:
      isReservedChannel in class AbstractNetworkAddon<ServerLoginNetworking.LoginQueryResponseHandler>
      Parameters:
      channelName - the channel name
      Returns:
      whether the channel is reserved