Class PacketProtocol
java.lang.Object
org.geysermc.mcprotocollib.network.packet.PacketProtocol
- Direct Known Subclasses:
MinecraftProtocol
A protocol for packet sending and receiving.
All implementations must have a constructor that takes in a
ByteBuf.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract PacketCodecHelperCreates a newPacketCodecHelperthat can be used for each session.abstract PacketHeaderGets the packet header of this protocol.abstract PacketRegistryGets the packet registry for this protocol.abstract StringGets the prefix used when locating SRV records for this protocol.abstract voidnewClientSession(Session session, boolean transferring) Called when a client session is created with this protocol.abstract voidnewServerSession(Server server, Session session) Called when a server session is created with this protocol.
-
Constructor Details
-
PacketProtocol
public PacketProtocol()
-
-
Method Details
-
getSRVRecordPrefix
Gets the prefix used when locating SRV records for this protocol.- Returns:
- The protocol's SRV record prefix.
-
getPacketHeader
Gets the packet header of this protocol.- Returns:
- The protocol's packet header.
-
createHelper
Creates a newPacketCodecHelperthat can be used for each session.- Returns:
- A new
PacketCodecHelper.
-
newClientSession
Called when a client session is created with this protocol.- Parameters:
session- The created session.transferring- If the client is being transferred between servers.
-
newServerSession
Called when a server session is created with this protocol.- Parameters:
server- The server that the session belongs to.session- The created session.
-
getPacketRegistry
Gets the packet registry for this protocol.- Returns:
- The protocol's packet registry.
-