Interface HandlerPacketBinding<P extends Packet>
- Type Parameters:
P
- The packet type
- All Superinterfaces:
PacketBinding<P>
A packet binding that allows the registration of
PacketHandler
s.-
Method Summary
Modifier and TypeMethodDescription<C extends EngineConnection>
PacketBinding<P>addHandler
(Class<C> connectionType, PacketHandler<? super P, ? super C> handler) Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
.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.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 Details
-
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
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
Removes thePacketHandler
.- Parameters:
handler
- The handler to remove- Returns:
- This binding, for chaining
-