Class PacketProtocol

java.lang.Object
org.geysermc.mcprotocollib.network.packet.PacketProtocol
Direct Known Subclasses:
MinecraftProtocol

public abstract class PacketProtocol extends Object
A protocol for packet sending and receiving. All implementations must have a constructor that takes in a ByteBuf.
  • Constructor Details

    • PacketProtocol

      public PacketProtocol()
  • Method Details

    • getSRVRecordPrefix

      public abstract String getSRVRecordPrefix()
      Gets the prefix used when locating SRV records for this protocol.
      Returns:
      The protocol's SRV record prefix.
    • getPacketHeader

      public abstract PacketHeader getPacketHeader()
      Gets the packet header of this protocol.
      Returns:
      The protocol's packet header.
    • createHelper

      public abstract PacketCodecHelper createHelper()
      Creates a new PacketCodecHelper that can be used for each session.
      Returns:
      A new PacketCodecHelper.
    • newClientSession

      public abstract void newClientSession(Session session)
      Called when a client session is created with this protocol.
      Parameters:
      session - The created session.
    • newServerSession

      public abstract void newServerSession(Server server, Session session)
      Called when a server session is created with this protocol.
      Parameters:
      server - The server that the session belongs to.
      session - The created session.
    • getInboundPacketRegistry

      public abstract PacketRegistry getInboundPacketRegistry()
      Gets the inbound packet registry for this protocol.
      Returns:
      The protocol's inbound packet registry.
    • getOutboundPacketRegistry

      public abstract PacketRegistry getOutboundPacketRegistry()
      Gets the outbound packet registry for this protocol.
      Returns:
      The protocol's outbound packet registry.