Class ScriptPacketListener<T>

java.lang.Object
dev.simplix.protocolize.api.listener.AbstractPacketListener<T>
dev.magicmq.pyspigot.bungee.manager.protocol.ScriptPacketListener<T>
Type Parameters:
T - The packet to listen for

public class ScriptPacketListener<T> extends dev.simplix.protocolize.api.listener.AbstractPacketListener<T>
A script listener that listens for BungeeCord packets.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScriptPacketListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction receiveFunction, PyFunction sendFunction, Class<T> packet, dev.simplix.protocolize.api.Direction direction, int priority)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.magicmq.pyspigot.manager.script.Script
    Get the script associated with this listener.
    void
    packetReceive(dev.simplix.protocolize.api.listener.PacketReceiveEvent<T> event)
    Called internally when the packet is received.
    void
    packetSend(dev.simplix.protocolize.api.listener.PacketSendEvent<T> event)
    Called internally when the packet is sent.
    Prints a representation of this ScriptPacketListener in string format, including the packet type listened to by the listener

    Methods inherited from class dev.simplix.protocolize.api.listener.AbstractPacketListener

    direction, priority, type

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ScriptPacketListener

      public ScriptPacketListener(dev.magicmq.pyspigot.manager.script.Script script, PyFunction receiveFunction, PyFunction sendFunction, Class<T> packet, dev.simplix.protocolize.api.Direction direction, int priority)
      Parameters:
      script - The script associated with this packet listener
      receiveFunction - The function to be called when the packet is received
      sendFunction - The function to be called when the packet is sent
      packet - The packet to listen for
      direction - The Direction of the listener
      priority - The priority of the listener
  • Method Details

    • packetReceive

      public void packetReceive(dev.simplix.protocolize.api.listener.PacketReceiveEvent<T> event)
      Called internally when the packet is received.
      Specified by:
      packetReceive in class dev.simplix.protocolize.api.listener.AbstractPacketListener<T>
      Parameters:
      event - The packet receive event
    • packetSend

      public void packetSend(dev.simplix.protocolize.api.listener.PacketSendEvent<T> event)
      Called internally when the packet is sent.
      Specified by:
      packetSend in class dev.simplix.protocolize.api.listener.AbstractPacketListener<T>
      Parameters:
      event - The packet send event
    • getScript

      public dev.magicmq.pyspigot.manager.script.Script getScript()
      Get the script associated with this listener.
      Returns:
      The script associated with this listener
    • toString

      public String toString()
      Prints a representation of this ScriptPacketListener in string format, including the packet type listened to by the listener
      Overrides:
      toString in class Object
      Returns:
      A string representation of the ScriptPacketListener