public interface PacketListener
Use PacketAdapter
for a simple wrapper around this interface.
Modifier and Type | Method and Description |
---|---|
org.bukkit.plugin.Plugin |
getPlugin()
Retrieve the plugin that created list packet listener.
|
ListeningWhitelist |
getReceivingWhitelist()
Retrieve which packets sent by the client this listener will observe.
|
ListeningWhitelist |
getSendingWhitelist()
Retrieve which packets sent by the server this listener will observe.
|
void |
onPacketReceiving(PacketEvent event)
Invoked right before a received packet from a client is being processed.
|
void |
onPacketSending(PacketEvent event)
Invoked right before a packet is transmitted from the server to the client.
|
void onPacketSending(PacketEvent event)
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.ASYNC
have been specified in the listener. This is off by default.
event
- - the packet that should be sent.void onPacketReceiving(PacketEvent event)
WARNING:
This method will be called asynchronously! You should synchronize with the main
thread using scheduleSyncDelayedTask
if you need to call the Bukkit API.
event
- - the packet that has been received.ListeningWhitelist getSendingWhitelist()
ListeningWhitelist getReceivingWhitelist()
org.bukkit.plugin.Plugin getPlugin()