Skip to content

Disconnect ​

com.jsmacrosce.jsmacros.client.api.event.impl.world.EventDisconnect

Since1.2.7Not cancellable

Fires when the client disconnects, including when leaving without a disconnection screen. The disconnection-screen reason is available as message when present.

js
JsMacros.on("Disconnect", JavaWrapper.methodToJava(function (event) {
  Chat.log(`Left the world${event.message === null ? "" : ": " + event.message.getString()}`);  
}))

Constructors ​

new EventDisconnect ​

new EventDisconnect(Component message)#
Wraps the disconnect reason when present and initializes the event with the client core. This does not itself perform a disconnect, kick, world leave, GUI change, or event dispatch.

Parameters:

  • message: raw reason component to wrap; null produces a null message field

Fields ​

message ​

message: TextHelperSince1.6.4read-only#
The disconnection-screen reason, or null when disconnecting without a disconnection screen.

Methods ​

toString ​

toString(): String#
Returns this event's name followed by the fixed empty-brace payload marker; it does not include or inspect the disconnect reason, so it remains safe when message is null.
Returns: the event name followed by :{}; this diagnostic string is not the full reason or serialized component JSON