setDisconnectionHook

Sets a disconnection hook to be triggered if the connection to this channel is lost, allowing one to safely log the player out in such case. If the channel has already disconnected by the time this function is invoked, the hook will be executed immediately.

Parameters

hook

the hook runnable to invoke if the connection is lost

Throws

if a hook was already registered