Package com.comphenix.protocol.events
Interface PacketListener
- All Known Implementing Classes:
MonitorAdapter,PacketAdapter,PacketLogging
public interface PacketListener
Represents a listener that receives notifications when packets are sending or being received.
Use PacketAdapter for a simple wrapper around this interface.
- Author:
- Kristian
-
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.plugin.PluginRetrieve the plugin that created list packet listener.Retrieve which packets sent by the client this listener will observe.Retrieve which packets sent by the server this listener will observe.voidonPacketReceiving(PacketEvent event)Invoked right before a received packet from a client is being processed.voidonPacketSending(PacketEvent event)Invoked right before a packet is transmitted from the server to the client.
-
Method Details
-
onPacketSending
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 thread in 1.6.4 and earlier, and thus the Bukkit API is safe to use.
In Minecraft 1.7.2 and later, this method MAY be executed asynchronously, but only if
ListenerOptions.ASYNChave been specified in the listener. This is off by default.- Parameters:
event- - the packet that should be sent.
-
onPacketReceiving
Invoked right before a received packet from a client is being processed.WARNING:
This method will be called asynchronously! You should synchronize with the main thread usingscheduleSyncDelayedTaskif you need to call the Bukkit API.- Parameters:
event- - the packet that has been received.
-
getSendingWhitelist
ListeningWhitelist getSendingWhitelist()Retrieve which packets sent by the server this listener will observe.- Returns:
- List of server packets to observe, along with the priority.
-
getReceivingWhitelist
ListeningWhitelist getReceivingWhitelist()Retrieve which packets sent by the client this listener will observe.- Returns:
- List of server packets to observe, along with the priority.
-
getPlugin
org.bukkit.plugin.Plugin getPlugin()Retrieve the plugin that created list packet listener.- Returns:
- The plugin, or NULL if not available.
-