Class ProtocolInjector

java.lang.Object
com.comphenix.protocol.injector.netty.ProtocolInjector
All Implemented Interfaces:
ChannelListener

public class ProtocolInjector extends Object implements ChannelListener
  • Field Details

    • REPORT_CANNOT_INJECT_INCOMING_CHANNEL

      public static final ReportType REPORT_CANNOT_INJECT_INCOMING_CHANNEL
  • Constructor Details

  • Method Details

    • isDebug

      public boolean isDebug()
      Description copied from interface: ChannelListener
      Determine if debug mode is enabled.
      Specified by:
      isDebug in interface ChannelListener
      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

      public boolean hasListener(Class<?> packetClass)
      Description copied from interface: ChannelListener
      Determine if there is a packet listener for the given packet.
      Specified by:
      hasListener in interface ChannelListener
      Parameters:
      packetClass - - the packet class to check.
      Returns:
      TRUE if there is such a listener, FALSE otherwise.
    • hasMainThreadListener

      public boolean hasMainThreadListener(Class<?> packetClass)
      Description copied from interface: ChannelListener
      Determine if there is a server packet listener that must be executed on the main thread.
      Specified by:
      hasMainThreadListener in interface ChannelListener
      Parameters:
      packetClass - - the packet class to check.
      Returns:
      TRUE if there is, FALSE otherwise.
    • getReporter

      public ErrorReporter getReporter()
      Description copied from interface: ChannelListener
      Retrieve the current error reporter.
      Specified by:
      getReporter in interface ChannelListener
      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

      public PacketEvent onPacketSending(Injector injector, Object packet, NetworkMarker marker)
      Description copied from interface: ChannelListener
      Invoked when a packet is being sent to the client.

      This is invoked on the main thread.

      Specified by:
      onPacketSending in interface ChannelListener
      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

      public PacketEvent onPacketReceiving(Injector injector, Object packet, NetworkMarker marker)
      Description copied from interface: ChannelListener
      Invoked when a packet is being received from a client.

      This is invoked on an asynchronous worker thread.

      Specified by:
      onPacketReceiving in interface ChannelListener
      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

      public boolean includeBuffer(Class<?> packetClass)
      Description copied from interface: ChannelListener
      Determine if we need the buffer data of a given client side packet.
      Specified by:
      includeBuffer in interface ChannelListener
      Parameters:
      packetClass - - the packet class.
      Returns:
      TRUE if we do, FALSE otherwise.
    • getPlayerInjector

      public PlayerInjectionHandler getPlayerInjector()
    • getPacketInjector

      public PacketInjector getPacketInjector()
      Retrieve a view of this protocol injector as a packet injector.
      Returns:
      The packet injector.