Interface ChannelListener
- All Known Implementing Classes:
NetworkManagerInjector
public interface ChannelListener
Represents a listener for received or sent packets.
-
Method Summary
Modifier and TypeMethodDescriptionRetrieve the current error reporter.booleanhasListener(Class<?> packetClass) Determine if there is a packet listener for the given packet.booleanbooleanhasMainThreadListener(Class<?> packetClass) Determine if there is a server packet listener that must be executed on the main thread.booleanisDebug()Determine if debug mode is enabled.onPacketReceiving(Injector injector, Object packet, NetworkMarker marker) Invoked when a packet is being received from a client.onPacketSending(Injector injector, Object packet, NetworkMarker marker) Invoked when a packet is being sent to the client.
-
Method Details
-
onPacketSending
Invoked when a packet is being sent to the client.This is invoked on the main thread.
- Parameters:
injector- - the channel injector.packet- - the packet.marker- - the network marker.- Returns:
- The packet even that was passed to the listeners, with a possible packet change, or NULL.
-
onPacketReceiving
Invoked when a packet is being received from a client.This is invoked on an asynchronous worker thread.
- Parameters:
injector- - the channel injector.packet- - the packet.marker- - the associated network marker, if any.- Returns:
- The packet even that was passed to the listeners, with a possible packet change, or NULL.
-
hasListener
Determine if there is a packet listener for the given packet.- Parameters:
packetClass- - the packet class to check.- Returns:
- TRUE if there is such a listener, FALSE otherwise.
-
hasMainThreadListener
Determine if there is a server packet listener that must be executed on the main thread.- Parameters:
packetClass- - the packet class to check.- Returns:
- TRUE if there is, FALSE otherwise.
-
hasMainThreadListener
-
getReporter
ErrorReporter getReporter()Retrieve the current error reporter.- Returns:
- The error reporter.
-
isDebug
boolean isDebug()Determine if debug mode is enabled.- Returns:
- TRUE if it is, FALSE otherwise.
-