Class SessionAdapter

java.lang.Object
org.geysermc.mcprotocollib.network.event.session.SessionAdapter
All Implemented Interfaces:
SessionListener
Direct Known Subclasses:
ClientListener, ServerListener

public class SessionAdapter extends Object implements SessionListener
An adapter for picking session events to listen for.
  • Constructor Details

    • SessionAdapter

      public SessionAdapter()
  • Method Details

    • packetReceived

      public void packetReceived(Session session, Packet packet)
      Description copied from interface: SessionListener
      Called when a session receives a packet.
      Specified by:
      packetReceived in interface SessionListener
      packet - the packet that was just received.
    • packetSending

      public Packet packetSending(Session session, Packet packet)
      Description copied from interface: SessionListener
      Called when a session is sending a packet.
      Specified by:
      packetSending in interface SessionListener
      Parameters:
      session - Session sending the packet.
      packet - Packet being sent.
      Returns:
      Packet to send, or null to cancel sending.
    • packetSent

      public void packetSent(Session session, Packet packet)
      Description copied from interface: SessionListener
      Called when a session sends a packet.
      Specified by:
      packetSent in interface SessionListener
      packet - Packet just sent.
    • packetError

      public boolean packetError(Session session, Throwable cause)
      Description copied from interface: SessionListener
      Called when a session encounters an error while reading or writing packet data.
      Specified by:
      packetError in interface SessionListener
      Parameters:
      session - Current session
      cause - Cause of the error.
      Returns:
      Whether the error should be suppressed.
    • connected

      public void connected(Session session)
      Description copied from interface: SessionListener
      Called when a session connects.
      Specified by:
      connected in interface SessionListener
      Parameters:
      session - Session that connected.
    • disconnecting

      public void disconnecting(Session session, net.kyori.adventure.text.Component reason, Throwable cause)
      Description copied from interface: SessionListener
      Called when a session is about to disconnect.
      Specified by:
      disconnecting in interface SessionListener
      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

      public void disconnected(Session session, net.kyori.adventure.text.Component reason, Throwable cause)
      Description copied from interface: SessionListener
      Called when a session is disconnected.
      Specified by:
      disconnected in interface SessionListener
      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.