Disconnect
com.jsmacrosce.jsmacros.client.api.event.impl.world.EventDisconnect
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
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;nullproduces anullmessage field
Fields
message
The disconnection-screen reason, or
null when disconnecting without a disconnection screen.Methods
toString
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