Interface PacketSender

All Known Subinterfaces:
LoginPacketSender

@NonExtendable public interface PacketSender
Represents something that supports sending packets to channels. Any packets sent must be registered in the appropriate registry.
  • Method Details

    • createPacket

      Packet<?> createPacket(CustomPayload payload)
      Creates a packet from a packet payload.
      Parameters:
      payload - the packet payload
    • sendPacket

      default void sendPacket(Packet<?> packet)
      Sends a packet.
      Parameters:
      packet - the packet
    • sendPacket

      default void sendPacket(CustomPayload payload)
      Sends a packet.
      Parameters:
      payload - the payload
    • sendPacket

      void sendPacket(Packet<?> packet, @Nullable @Nullable PacketCallbacks callback)
      Sends a packet.
      Parameters:
      packet - the packet
      callback - an optional callback to execute after the packet is sent, may be null.
    • sendPacket

      default void sendPacket(CustomPayload payload, @Nullable @Nullable PacketCallbacks callback)
      Sends a packet.
      Parameters:
      payload - the payload
      callback - an optional callback to execute after the packet is sent, may be null.
    • disconnect

      void disconnect(Text disconnectReason)
      Disconnects the player.
      Parameters:
      disconnectReason - the reason for disconnection