Interface PacketChannel

All Superinterfaces:
NetworkChannel
All Known Subinterfaces:
RawPacketChannel

public interface PacketChannel extends NetworkChannel
Represents a channel for network communication associated with a packet.

This channel is used for listening to communication over packets between the server and client and can be used to send or receive packets.

When the message type is the actual packet class (i.e., a Cloudburst Bedrock packet or an MCProtocolLib Java packet), Geyser can derive the packet ID from the class itself, so no ID is required here. For channels that operate on raw buffers via Message.Packet implementations, use RawPacketChannel instead, which requires the packet ID to be explicitly set.

Since:
2.9.2
  • Method Details

    • bedrock

      static PacketChannel bedrock(Extension extension, Class<?> packetType)
      Creates a new Bedrock PacketChannel keyed by the given packet class.
      Parameters:
      extension - the extension creating the channel
      packetType - the packet class this channel handles
      Returns:
      a new Bedrock packet channel
    • java

      static PacketChannel java(Extension extension, Class<?> packetType)
      Creates a new Java PacketChannel keyed by the given packet class.
      Parameters:
      extension - the extension creating the channel
      packetType - the packet class this channel handles
      Returns:
      a new Java packet channel