Class PacketErrorEvent

java.lang.Object
org.geysermc.mcprotocollib.network.event.session.PacketErrorEvent
All Implemented Interfaces:
SessionEvent

public class PacketErrorEvent extends Object implements SessionEvent
Called when a session encounters an error while reading or writing packet data.
  • Constructor Details

    • PacketErrorEvent

      public PacketErrorEvent(Session session, Throwable cause, @Nullable Class<? extends Packet> packetClass)
      Creates a new SessionErrorEvent instance.
      Parameters:
      session - Session that the error came from.
      cause - Cause of the error.
  • Method Details

    • getSession

      public Session getSession()
      Gets the session involved in this event.
      Returns:
      The event's session.
    • getCause

      public Throwable getCause()
      Gets the Throwable responsible for the error.
      Returns:
      The Throwable responsible for the error.
    • getPacketClass

      public Class<? extends Packet> getPacketClass()
      Gets the packet class where the error occurred in, if it is known.
      Returns:
      the packet class related to this packet error
    • shouldSuppress

      public boolean shouldSuppress()
      Gets whether the error should be suppressed. If the error is not suppressed, it will be passed on through internal error handling and disconnect the session. The default value is false.
      Returns:
      Whether the error should be suppressed.
    • setSuppress

      public void setSuppress(boolean suppress)
      Sets whether the error should be suppressed. If the error is not suppressed, it will be passed on through internal error handling and disconnect the session.
      Parameters:
      suppress - Whether the error should be suppressed.
    • call

      public void call(SessionListener listener)
      Description copied from interface: SessionEvent
      Calls the event.
      Specified by:
      call in interface SessionEvent
      Parameters:
      listener - Listener to call the event on.