Interface PacketRegistry

    • Method Detail

      • register

        <P extends PacketHandlerPacketBinding<P> register​(Class<P> packetClass,
                                                            int packetOpcode)
        Register a packet class to this channel without a receiving handler. This will only allow the packet to be sent, this channel binding will not be able to receive the packet.

        RequestPacket types may not be registered using this method, they are only supported by TransactionalPacketRegistry.registerTransactional(java.lang.Class<P>, java.lang.Class<R>, int).

        Type Parameters:
        P - The type of the packet
        Parameters:
        packetClass - The class of the packet being registered. Note: the class must have a no-args constructor
        packetOpcode - A unique opcode for this packet
        Returns:
        The created packet binding
      • binding

        <P extends PacketOptional<PacketBinding<P>> binding​(Class<P> packetClass)
        Gets the PacketBinding for the given packet class, if the packet type is registered to this channel.
        Type Parameters:
        P - The type of the packet
        Parameters:
        packetClass - The packet class
        Returns:
        The packet binding, if found
      • binding

        Optional<PacketBinding<?>> binding​(int opcode)
        Gets the PacketBinding for the given packet class, if the packet type is registered to this channel.
        Parameters:
        opcode - The opcode
        Returns:
        The opcode binding, if found