public abstract class PacketAdapter extends java.lang.Object implements PacketListener
Modifier and Type | Field and Description |
---|---|
protected ConnectionSide |
connectionSide |
protected org.bukkit.plugin.Plugin |
plugin |
protected ListeningWhitelist |
receivingWhitelist |
protected ListeningWhitelist |
sendingWhitelist |
Constructor and Description |
---|
PacketAdapter(org.bukkit.plugin.Plugin plugin,
ConnectionSide connectionSide,
java.lang.Integer... packets)
Initialize a packet listener with default priority.
|
PacketAdapter(org.bukkit.plugin.Plugin plugin,
ConnectionSide connectionSide,
ListenerPriority listenerPriority,
java.lang.Integer... packets)
Initialize a packet listener for a single connection side.
|
Modifier and Type | Method and Description |
---|---|
org.bukkit.plugin.Plugin |
getPlugin()
Retrieve the plugin that created list packet listener.
|
static java.lang.String |
getPluginName(PacketListener listener)
Retrieves the name of the plugin that has been associated with the 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 recieved packet from a client is being processed.
|
void |
onPacketSending(PacketEvent event)
Invoked right before a packet is transmitted from the server to the client.
|
java.lang.String |
toString() |
protected org.bukkit.plugin.Plugin plugin
protected ConnectionSide connectionSide
protected ListeningWhitelist receivingWhitelist
protected ListeningWhitelist sendingWhitelist
public PacketAdapter(org.bukkit.plugin.Plugin plugin, ConnectionSide connectionSide, java.lang.Integer... packets)
plugin
- - the plugin that spawned this listener.connectionSide
- - the packet type the listener is looking for.packets
- - the packet IDs the listener is looking for.public PacketAdapter(org.bukkit.plugin.Plugin plugin, ConnectionSide connectionSide, ListenerPriority listenerPriority, java.lang.Integer... packets)
plugin
- - the plugin that spawned this listener.connectionSide
- - the packet type the listener is looking for.listenerPriority
- - the event priority.packets
- - the packet IDs the listener is looking for.public void onPacketReceiving(PacketEvent event)
PacketListener
onPacketReceiving
in interface PacketListener
event
- - the packet that has been recieved.public void onPacketSending(PacketEvent event)
PacketListener
Note that the packet may be replaced, if needed.
onPacketSending
in interface PacketListener
event
- - the packet that should be sent.public ListeningWhitelist getReceivingWhitelist()
PacketListener
getReceivingWhitelist
in interface PacketListener
public ListeningWhitelist getSendingWhitelist()
PacketListener
getSendingWhitelist
in interface PacketListener
public org.bukkit.plugin.Plugin getPlugin()
PacketListener
getPlugin
in interface PacketListener
public static java.lang.String getPluginName(PacketListener listener)
public java.lang.String toString()
toString
in class java.lang.Object