Class ScriptPluginMessageListener
java.lang.Object
dev.magicmq.pyspigot.bukkit.manager.messaging.ScriptPluginMessageListener
- All Implemented Interfaces:
PluginMessageListener
A class that represents a script plugin message listener listening on a single channel.
-
Constructor Summary
ConstructorsConstructorDescriptionScriptPluginMessageListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, String channel) -
Method Summary
Modifier and TypeMethodDescriptionGet the channel this listener is listening on.dev.magicmq.pyspigot.manager.script.ScriptGet the script associated with this ScriptPluginMessageListener.voidonPluginMessageReceived(String channel, Player player, byte[] message) Called internally when a message is received on the registered channel.
-
Constructor Details
-
ScriptPluginMessageListener
public ScriptPluginMessageListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, String channel) - Parameters:
script- The script associated with this ScriptPluginMessageListenerfunction- The function that should be called when a message is received on the given channelchannel- The channel this listener is listening on
-
-
Method Details
-
getScript
public dev.magicmq.pyspigot.manager.script.Script getScript()Get the script associated with this ScriptPluginMessageListener.- Returns:
- The script associated with this ScriptPluginMessageListener
-
getChannel
Get the channel this listener is listening on.- Returns:
- The channel being listened on
-
onPluginMessageReceived
Called internally when a message is received on the registered channel.Note that although the channel is passed as a parameter, only messages received on the registered channel will result in a call to this method.
- Specified by:
onPluginMessageReceivedin interfacePluginMessageListener- Parameters:
channel- Channel that the message was sent throughplayer- Source of the messagemessage- The raw message that was sent
-