Class PacketErrorEvent
java.lang.Object
org.geysermc.mcprotocollib.network.event.session.PacketErrorEvent
- All Implemented Interfaces:
SessionEvent
Called when a session encounters an error while reading or writing packet data.
-
Constructor Summary
ConstructorsConstructorDescriptionPacketErrorEvent(Session session, Throwable cause) Creates a new SessionErrorEvent instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidcall(SessionListener listener) Calls the event.getCause()Gets the Throwable responsible for the error.Gets the session involved in this event.voidsetSuppress(boolean suppress) Sets whether the error should be suppressed.booleanGets whether the error should be suppressed.
-
Constructor Details
-
PacketErrorEvent
Creates a new SessionErrorEvent instance.- Parameters:
session- Session that the error came from.cause- Cause of the error.
-
-
Method Details
-
getSession
Gets the session involved in this event.- Returns:
- The event's session.
-
getCause
Gets the Throwable responsible for the error.- Returns:
- The Throwable responsible for the 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
Description copied from interface:SessionEventCalls the event.- Specified by:
callin interfaceSessionEvent- Parameters:
listener- Listener to call the event on.
-