Interface ChannelListener

All Known Implementing Classes:
ProtocolInjector

public interface ChannelListener
Represents a listener for received or sent packets.
Author:
Kristian
  • Method Details

    • onPacketSending

      PacketEvent onPacketSending(Injector injector, Object packet, NetworkMarker marker)
      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

      PacketEvent onPacketReceiving(Injector injector, Object packet, NetworkMarker marker)
      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

      boolean hasListener(Class<?> packetClass)
      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

      boolean hasMainThreadListener(Class<?> packetClass)
      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.
    • includeBuffer

      boolean includeBuffer(Class<?> packetClass)
      Determine if we need the buffer data of a given client side packet.
      Parameters:
      packetClass - - the packet class.
      Returns:
      TRUE if we do, FALSE otherwise.
    • 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.