Interface IPacketHandler

All Known Implementing Classes:
GamePacketHandler

public interface IPacketHandler
An interface that represents a handler for inbound packets.
  • Method Details

    • registerHandler

      void registerHandler(int packetId, @Nonnull Consumer<ToServerPacket> handler)
      Called to register a packet handler for a specific packet.
      Parameters:
      packetId - The unique ID of the packet to register a handler for.
      handler - The callback that should handle this packet.
    • registerNoOpHandlers

      void registerNoOpHandlers(int... packetIds)
      Called to register a collection of packet IDs, without an associated consumer.
      Parameters:
      packetIds - The unique ID of the packet IDs to register.
    • getPlayerRef

      @Nonnull PlayerRef getPlayerRef()
      Returns:
      the PlayerRef of the connection associated with this handler.
    • getIdentifier

      @Nonnull String getIdentifier()
      Returns:
      the unique identifier of this packet handler.