Class MonitorAdapter

java.lang.Object
com.comphenix.protocol.events.MonitorAdapter
All Implemented Interfaces:
PacketListener

public abstract class MonitorAdapter extends Object implements PacketListener
Represents a listener that is notified of every sent and received packet.
  • Constructor Details

    • MonitorAdapter

      public MonitorAdapter(org.bukkit.plugin.Plugin plugin, ConnectionSide side)
    • MonitorAdapter

      @Deprecated public MonitorAdapter(org.bukkit.plugin.Plugin plugin, ConnectionSide side, Logger logger)
      Deprecated.
  • Method Details

    • getSendingWhitelist

      public ListeningWhitelist getSendingWhitelist()
      Description copied from interface: PacketListener
      Retrieve which packets sent by the server this listener will observe.
      Specified by:
      getSendingWhitelist in interface PacketListener
      Returns:
      List of server packets to observe, along with the priority.
    • getReceivingWhitelist

      public ListeningWhitelist getReceivingWhitelist()
      Description copied from interface: PacketListener
      Retrieve which packets sent by the client this listener will observe.
      Specified by:
      getReceivingWhitelist in interface PacketListener
      Returns:
      List of server packets to observe, along with the priority.
    • getPlugin

      public org.bukkit.plugin.Plugin getPlugin()
      Description copied from interface: PacketListener
      Retrieve the plugin that created list packet listener.
      Specified by:
      getPlugin in interface PacketListener
      Returns:
      The plugin, or NULL if not available.
    • onPacketSending

      public void onPacketSending(PacketEvent event)
      Description copied from interface: PacketListener
      Invoked right before a packet is transmitted from the server to the client.

      Note that the packet may be replaced, if needed.

      This method is executed on the main server thread by default. However, some spigot forks (like paper) schedule specific packets off the main thread. If the ListenerOptions.ASYNC option is not specified any invocation of this method will be on the main server thread.

      Specified by:
      onPacketSending in interface PacketListener
      Parameters:
      event - - the packet that should be sent.
    • onPacketReceiving

      public void onPacketReceiving(PacketEvent event)
      Description copied from interface: PacketListener
      Invoked right before a received packet from a client is being processed.

      This method will be called asynchronously (or on the netty event loop) by default. If the ListenerOptions.SYNC option is specified, the invocation of this method will be synced to the main server thread which might cause issues due to delayed packets.

      Specified by:
      onPacketReceiving in interface PacketListener
      Parameters:
      event - - the packet that has been received.