Class AsyncProtocolManager
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the current ProtocolLib AsynchronousManager.getAsyncPacketListener(dev.magicmq.pyspigot.manager.script.Script script, PacketType packetType) Get the asynchronous packet listener for a particular packet type associated with a scriptgetAsyncPacketListeners(dev.magicmq.pyspigot.manager.script.Script script) Get all asynchronous packet listeners associated with a scriptregisterAsyncPacketListener(PyFunction function, PacketType type) Register a new asynchronous packet listener with default priority.registerAsyncPacketListener(PyFunction function, PacketType type, ListenerPriority priority) Register a new asynchronous packet listener.registerTimeoutPacketListener(PyFunction function, PacketType type) Register a new asynchronous timeout packet listener with default priority.registerTimeoutPacketListener(PyFunction function, PacketType type, ListenerPriority priority) Register a new asynchronous timeout packet listener.voidUnregister an asynchronous packet listener.voidunregisterAsyncPacketListeners(dev.magicmq.pyspigot.manager.script.Script script) Unregister all asynchronous packet listeners belonging to a script.
-
Constructor Details
-
AsyncProtocolManager
protected AsyncProtocolManager()
-
-
Method Details
-
getAsynchronousManager
Get the current ProtocolLib AsynchronousManager.- Returns:
- The
AsynchronousManager
-
registerAsyncPacketListener
Register a new asynchronous packet listener with default priority.This method will automatically register a
PacketReceivingListeneror aPacketSendingListener, depending on if thePacketTypeis for the server or client, respectively.Note: This should be called from scripts only!
- Parameters:
function- The function that should be called when the packet event occurstype- The packet type to listen for- Returns:
- A
ScriptPacketListenerrepresenting the asynchronous packet listener that was registered
-
registerAsyncPacketListener
public ScriptPacketListener registerAsyncPacketListener(PyFunction function, PacketType type, ListenerPriority priority) Register a new asynchronous packet listener.This method will automatically register a
PacketReceivingListeneror aPacketSendingListener, depending on if thePacketTypeis for the server or client, respectively.Note: This should be called from scripts only!
- Parameters:
function- The function that should be called when the packet event occurstype- The packet type to listen forpriority- The priority of the asynchronous packet listener relative to other packet listeners- Returns:
- A
ScriptPacketListenerrepresenting the asynchronous packet listener that was registered
-
registerTimeoutPacketListener
Register a new asynchronous timeout packet listener with default priority.This method will automatically register a
PacketReceivingListeneror aPacketSendingListener, depending on if thePacketTypeis for the server or client, respectively.Note: This should be called from scripts only!
- Parameters:
function- The function that should be called when the packet event occurstype- The packet type to listen for- Returns:
- A
ScriptPacketListenerrepresenting the asynchronous timeout packet listener that was registered
-
registerTimeoutPacketListener
public ScriptPacketListener registerTimeoutPacketListener(PyFunction function, PacketType type, ListenerPriority priority) Register a new asynchronous timeout packet listener.This method will automatically register a
PacketReceivingListeneror aPacketSendingListener, depending on if thePacketTypeis for the server or client, respectively.Note: This should be called from scripts only!
- Parameters:
function- The function that should be called when the packet event occurstype- The packet type to listen forpriority- The priority of the asynchronous timeout packet listener relative to other asynchronous timeout packet listeners- Returns:
- A
ScriptPacketListenerrepresenting the asynchronous timeout packet listener that was registered
-
unregisterAsyncPacketListener
Unregister an asynchronous packet listener.Note: This should be called from scripts only!
- Parameters:
listener- The asynchronous packet listener to unregister
-
unregisterAsyncPacketListeners
public void unregisterAsyncPacketListeners(dev.magicmq.pyspigot.manager.script.Script script) Unregister all asynchronous packet listeners belonging to a script.- Parameters:
script- The script whose asynchronous packet listeners should be unregistered
-
getAsyncPacketListeners
public List<ScriptPacketListener> getAsyncPacketListeners(dev.magicmq.pyspigot.manager.script.Script script) Get all asynchronous packet listeners associated with a script- Parameters:
script- The script to get asynchronous packet listeners from- Returns:
- An immutable list of
ScriptPacketListenercontaining all asynchronous packet listeners associated with this script. Will return an empty list if there are no asynchronous packet listeners associated with the script
-
getAsyncPacketListener
public ScriptPacketListener getAsyncPacketListener(dev.magicmq.pyspigot.manager.script.Script script, PacketType packetType) Get the asynchronous packet listener for a particular packet type associated with a script- Parameters:
script- The scriptpacketType- The packet type- Returns:
- The
ScriptPacketListenerassociated with the script and packet type, or null if there is none
-