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

      <C extends EngineConnection> PacketBinding<P> addHandler(EngineConnectionSide<C> side, PacketHandler<? super P,? super C> handler)
      Adds a PacketHandler to handle the packets of type HandlerPacketBinding. The handler is invoked every time the packet is sent to the given side.
      Type Parameters:
      C - The connection type
      Parameters:
      side - The side the handler should be used on
      handler - The handler to add
      Returns:
      This binding, for chaining
    • addHandler

      <C extends EngineConnection> PacketBinding<P> addHandler(Class<C> connectionType, PacketHandler<? super P,? super C> 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:
      C - The connection type
      Parameters:
      connectionType - 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,EngineConnection> 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

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

      <C extends EngineConnection> PacketBinding<P> removeHandler(Class<C> connectionType, PacketHandler<? super P,? super C> handler)
      Removes the PacketHandler for the given connection type.
      Type Parameters:
      C - The connection type
      Parameters:
      connectionType - The connection type 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