Class ScriptPacketListener
java.lang.Object
com.comphenix.protocol.events.PacketAdapter
dev.magicmq.pyspigot.bukkit.manager.protocol.ScriptPacketListener
- All Implemented Interfaces:
PacketListener
- Direct Known Subclasses:
PacketReceivingListener,PacketSendingListener
An abstract class designed to represent a basic script packet listener.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.comphenix.protocol.events.PacketAdapter
PacketAdapter.AdapterParameteters -
Field Summary
Fields inherited from class com.comphenix.protocol.events.PacketAdapter
connectionSide, plugin, receivingWhitelist, sendingWhitelist -
Constructor Summary
ConstructorsConstructorDescriptionScriptPacketListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, PacketType packetType, ListenerPriority listenerPriority, ListenerType listenerType) -
Method Summary
Modifier and TypeMethodDescriptionvoidcallToScript(PacketEvent event) A helper method to call a script's packet listener function when the packet event occurs.Get the function that should be called when the packet event occurs.The listener type of this listener.Get the packet type being listener for.dev.magicmq.pyspigot.manager.script.ScriptGet the script associated with this listener.toString()Prints a representation of this ScriptPacketListener in string format, including the packet type listened to by the listenerMethods inherited from class com.comphenix.protocol.events.PacketAdapter
getPlugin, getPluginName, getPluginName, getReceivingWhitelist, getSendingWhitelist, onPacketReceiving, onPacketSending, params, params
-
Constructor Details
-
ScriptPacketListener
public ScriptPacketListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, PacketType packetType, ListenerPriority listenerPriority, ListenerType listenerType) - Parameters:
script- The script associated with this packet listenerfunction- The function to be called when the packet event occurspacketType- The packet type to listen forlistenerPriority- TheListenerPriorityof this listenerlistenerType- TheListenerTypeof this listener
-
-
Method Details
-
getScript
public dev.magicmq.pyspigot.manager.script.Script getScript()Get the script associated with this listener.- Returns:
- The script associated with this listener
-
getFunction
Get the function that should be called when the packet event occurs.- Returns:
- The function that should be called
-
getPacketType
Get the packet type being listener for.- Returns:
- The packet type beign listened for
-
getListenerType
The listener type of this listener.- Returns:
- The
ListenerTypeof this listener
-
callToScript
A helper method to call a script's packet listener function when the packet event occurs.- Parameters:
event- The event that occurred, will be passed to the script's function
-
toString
Prints a representation of this ScriptPacketListener in string format, including the packet type listened to by the listener- Overrides:
toStringin classPacketAdapter- Returns:
- A string representation of the ScriptPacketListener
-