Class ProtocolInjector
java.lang.Object
com.comphenix.protocol.injector.netty.ProtocolInjector
- All Implemented Interfaces:
ChannelListener
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProtocolInjector(org.bukkit.plugin.Plugin plugin, ListenerInvoker invoker, ErrorReporter reporter) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Clean up any remaning injections.Retrieve a view of this protocol injector as a packet injector.Retrieve the current error reporter.booleanhasListener(Class<?> packetClass)Determine if there is a packet listener for the given packet.booleanhasMainThreadListener(Class<?> packetClass)Determine if there is a server packet listener that must be executed on the main thread.booleanincludeBuffer(Class<?> packetClass)Determine if we need the buffer data of a given client side packet.voidinject()Inject into the spigot connection class.voidinjectPlayer(org.bukkit.entity.Player player)Inject our packet handling into a specific player.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.voidsetDebug(boolean debug)Set whether or not the debug mode is enabled.
-
Field Details
-
REPORT_CANNOT_INJECT_INCOMING_CHANNEL
-
-
Constructor Details
-
ProtocolInjector
public ProtocolInjector(org.bukkit.plugin.Plugin plugin, ListenerInvoker invoker, ErrorReporter reporter)
-
-
Method Details
-
isDebug
public boolean isDebug()Description copied from interface:ChannelListenerDetermine if debug mode is enabled.- Specified by:
isDebugin interfaceChannelListener- Returns:
- TRUE if it is, FALSE otherwise.
-
setDebug
public void setDebug(boolean debug)Set whether or not the debug mode is enabled.- Parameters:
debug- - TRUE if it is, FALSE otherwise.
-
inject
public void inject()Inject into the spigot connection class. -
hasListener
Description copied from interface:ChannelListenerDetermine if there is a packet listener for the given packet.- Specified by:
hasListenerin interfaceChannelListener- Parameters:
packetClass- - the packet class to check.- Returns:
- TRUE if there is such a listener, FALSE otherwise.
-
hasMainThreadListener
Description copied from interface:ChannelListenerDetermine if there is a server packet listener that must be executed on the main thread.- Specified by:
hasMainThreadListenerin interfaceChannelListener- Parameters:
packetClass- - the packet class to check.- Returns:
- TRUE if there is, FALSE otherwise.
-
getReporter
Description copied from interface:ChannelListenerRetrieve the current error reporter.- Specified by:
getReporterin interfaceChannelListener- Returns:
- The error reporter.
-
injectPlayer
public void injectPlayer(org.bukkit.entity.Player player)Inject our packet handling into a specific player.- Parameters:
player- Player to inject into
-
close
public void close()Clean up any remaning injections. -
onPacketSending
Description copied from interface:ChannelListenerInvoked when a packet is being sent to the client.This is invoked on the main thread.
- Specified by:
onPacketSendingin interfaceChannelListener- 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
Description copied from interface:ChannelListenerInvoked when a packet is being received from a client.This is invoked on an asynchronous worker thread.
- Specified by:
onPacketReceivingin interfaceChannelListener- 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.
-
includeBuffer
Description copied from interface:ChannelListenerDetermine if we need the buffer data of a given client side packet.- Specified by:
includeBufferin interfaceChannelListener- Parameters:
packetClass- - the packet class.- Returns:
- TRUE if we do, FALSE otherwise.
-
getPlayerInjector
-
getPacketInjector
Retrieve a view of this protocol injector as a packet injector.- Returns:
- The packet injector.
-