Interface HandlerPacketBinding<P extends Packet>

Type Parameters:
P - The packet type
All Superinterfaces:
PacketBinding<P>

public interface HandlerPacketBinding<P extends Packet> extends PacketBinding<P>
A packet binding that allows the registration of PacketHandlers.
  • Method Details

    • addHandler

      <S extends EngineConnectionState> PacketBinding<P> addHandler(Class<S> connectionState, PacketHandler<? super P,? super S> handler)
      Adds a PacketHandler to handle the packets of type HandlerPacketBinding. The handler is invoked every time the packet is received by the given connection type.
      Type Parameters:
      S - The connection state
      Parameters:
      connectionState - The connection type the handler should be used by
      handler - The handler to add
      Returns:
      This binding, for chaining
    • addHandler

      PacketBinding<P> addHandler(PacketHandler<? super P,EngineConnectionState> handler)
      Adds a PacketHandler to handle the packets of type HandlerPacketBinding. The handler is invoked every time the packet is sent to either side.
      Parameters:
      handler - The handler to add
      Returns:
      This binding, for chaining
    • removeHandler

      <S extends EngineConnectionState> PacketBinding<P> removeHandler(Class<S> connectionState, PacketHandler<? super P,? super S> handler)
      Removes the PacketHandler for the given connection type.
      Type Parameters:
      S - The connection state
      Parameters:
      connectionState - The connection state the handler should be removes from
      handler - The handler to remove
      Returns:
      This binding, for chaining
    • removeHandler

      PacketBinding<P> removeHandler(PacketHandler<? super P,?> handler)
      Removes the PacketHandler.
      Parameters:
      handler - The handler to remove
      Returns:
      This binding, for chaining