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 ofPacketHandler
s.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <C extends EngineConnection>
PacketBinding<P>addHandler(Class<C> connectionType, PacketHandler<? super P,? super C> handler)
Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
.PacketBinding<P>
addHandler(PacketHandler<? super P,EngineConnection> handler)
Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
.<C extends EngineConnection>
PacketBinding<P>addHandler(EngineConnectionSide<C> side, PacketHandler<? super P,? super C> handler)
Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
.<C extends EngineConnection>
PacketBinding<P>removeHandler(Class<C> connectionType, PacketHandler<? super P,? super C> handler)
Removes thePacketHandler
for the given connection type.PacketBinding<P>
removeHandler(PacketHandler<? super P,?> handler)
Removes thePacketHandler
.<C extends EngineConnection>
PacketBinding<P>removeHandler(EngineConnectionSide<C> side, PacketHandler<? super P,? super C> handler)
Removes thePacketHandler
for the given side.-
Methods inherited from interface org.spongepowered.api.network.channel.packet.PacketBinding
opcode, packetType
-
-
-
-
Method Detail
-
addHandler
<C extends EngineConnection> PacketBinding<P> addHandler(EngineConnectionSide<C> side, PacketHandler<? super P,? super C> handler)
Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
. 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 onhandler
- 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 aPacketHandler
to handle the packets of typeHandlerPacketBinding
. 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 byhandler
- The handler to add- Returns:
- This binding, for chaining
-
addHandler
PacketBinding<P> addHandler(PacketHandler<? super P,EngineConnection> handler)
Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
. 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 thePacketHandler
for the given side.- Type Parameters:
C
- The connection type- Parameters:
side
- The side the handler should be removes fromhandler
- 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 thePacketHandler
for the given connection type.- Type Parameters:
C
- The connection type- Parameters:
connectionType
- The connection type the handler should be removes fromhandler
- The handler to remove- Returns:
- This binding, for chaining
-
removeHandler
PacketBinding<P> removeHandler(PacketHandler<? super P,?> handler)
Removes thePacketHandler
.- Parameters:
handler
- The handler to remove- Returns:
- This binding, for chaining
-
-