Interface SessionListener

All Known Implementing Classes:
ClientListener, ServerListener, SessionAdapter

public interface SessionListener
A listener for listening to session events.
  • Method Details

    • packetReceived

      void packetReceived(Session session, Packet packet)
      Called when a session receives a packet.
      Parameters:
      packet - the packet that was just received.
    • packetSending

      Packet packetSending(Session session, Packet packet)
      Called when a session is sending a packet.
      Parameters:
      session - Session sending the packet.
      packet - Packet being sent.
      Returns:
      Packet to send, or null to cancel sending.
    • packetSent

      void packetSent(Session session, Packet packet)
      Called when a session sends a packet.
      Parameters:
      packet - Packet just sent.
    • packetError

      boolean packetError(Session session, Throwable throwable)
      Called when a session encounters an error while reading or writing packet data.
      Parameters:
      session - Current session
      throwable - Cause of the error.
      Returns:
      Whether the error should be suppressed.
    • connected

      void connected(Session session)
      Called when a session connects.
      Parameters:
      session - Session that connected.
    • disconnecting

      void disconnecting(Session session, net.kyori.adventure.text.Component reason, Throwable cause)
      Called when a session is about to disconnect.
      Parameters:
      session - Session being disconnected.
      reason - Reason for the session to disconnect.
      cause - Throwable that caused the disconnect, or null if not caused by a throwable.
    • disconnected

      void disconnected(Session session, net.kyori.adventure.text.Component reason, Throwable cause)
      Called when a session is disconnected.
      Parameters:
      session - Session that disconnected.
      reason - Reason for the session to disconnect.
      cause - Throwable that caused the disconnect, or null if not caused by a throwable.