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<S extends EngineConnectionState>
PacketBinding<P> addHandler
(Class<S> connectionState, PacketHandler<? super P, ? super S> handler) Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
.addHandler
(PacketHandler<? super P, EngineConnectionState> handler) Adds aPacketHandler
to handle the packets of typeHandlerPacketBinding
.<S extends EngineConnectionState>
PacketBinding<P> removeHandler
(Class<S> connectionState, PacketHandler<? super P, ? super S> handler) Removes thePacketHandler
for the given connection type.removeHandler
(PacketHandler<? super P, ?> handler) Removes thePacketHandler
.Methods inherited from interface org.spongepowered.api.network.channel.packet.PacketBinding
opcode, packetType
-
Method Details
-
addHandler
<S extends EngineConnectionState> PacketBinding<P> addHandler(Class<S> connectionState, PacketHandler<? super P, ? super S> 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:
S
- The connection state- Parameters:
connectionState
- 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
<S extends EngineConnectionState> PacketBinding<P> removeHandler(Class<S> connectionState, PacketHandler<? super P, ? super S> handler) Removes thePacketHandler
for the given connection type.- Type Parameters:
S
- The connection state- Parameters:
connectionState
- The connection state 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
-