Class ScriptPluginMessageListener

java.lang.Object
dev.magicmq.pyspigot.bukkit.manager.messaging.ScriptPluginMessageListener
All Implemented Interfaces:
PluginMessageListener

public class ScriptPluginMessageListener extends Object implements PluginMessageListener
A class that represents a script plugin message listener listening on a single channel.
  • Constructor Details

    • ScriptPluginMessageListener

      public ScriptPluginMessageListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction function, String channel)
      Parameters:
      script - The script associated with this ScriptPluginMessageListener
      function - The function that should be called when a message is received on the given channel
      channel - 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

      public String getChannel()
      Get the channel this listener is listening on.
      Returns:
      The channel being listened on
    • onPluginMessageReceived

      public void onPluginMessageReceived(String channel, Player player, byte[] message)
      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:
      onPluginMessageReceived in interface PluginMessageListener
      Parameters:
      channel - Channel that the message was sent through
      player - Source of the message
      message - The raw message that was sent