2013-11-23 15:26:24 -05:00
|
|
|
return
|
|
|
|
{
|
|
|
|
HOOK_DISCONNECT =
|
|
|
|
{
|
2014-05-02 06:23:22 -04:00
|
|
|
CalledWhen = [[
|
|
|
|
A client has disconnected, either by explicitly sending the disconnect packet (in older protocols) or
|
|
|
|
their connection was terminated
|
|
|
|
]],
|
2013-11-23 15:26:24 -05:00
|
|
|
DefaultFnName = "OnDisconnect", -- also used as pagename
|
|
|
|
Desc = [[
|
2014-05-02 06:23:22 -04:00
|
|
|
This hook is called when a client has disconnected from the server, for whatever reason. It is also
|
|
|
|
called when the client sends the Disconnect packet (only in pre-1.7 protocols). This hook is not called
|
|
|
|
for server ping connections.</p>
|
|
|
|
<p>
|
|
|
|
Note that the hook is called even for connections to players who failed to auth. In such a case there's
|
|
|
|
no {{cPlayer}} object associated with the client.</p>
|
|
|
|
<p>
|
|
|
|
See also the {{OnHandshake|HOOK_HANDSHAKE}} hook which is called when the client connects (and presents
|
|
|
|
a handshake message, so that they are not just status-pinging). If you need to store a per-player
|
|
|
|
object, use the {{OnPlayerJoined|HOOK_PLAYER_JOINED}} and {{OnPlayerDestroyed|HOOK_PLAYER_DESTROYED}}
|
|
|
|
hooks instead, those are guaranteed to have the {{cPlayer}} object associated.
|
2013-11-23 15:26:24 -05:00
|
|
|
]],
|
|
|
|
Params =
|
|
|
|
{
|
2014-05-02 06:23:22 -04:00
|
|
|
{ Name = "Client", Type = "{{cClientHandle}}", Notes = "The client who has disconnected" },
|
2013-11-23 15:26:24 -05:00
|
|
|
{ Name = "Reason", Type = "string", Notes = "The reason that the client has sent in the disconnect packet" },
|
|
|
|
},
|
|
|
|
Returns = [[
|
2014-02-03 16:12:44 -05:00
|
|
|
If the function returns false or no value, MCServer calls other plugins' callbacks for this event.
|
|
|
|
If the function returns true, no other plugins are called for this event. In either case,
|
2014-05-02 06:23:22 -04:00
|
|
|
the client is disconnected.
|
2013-11-23 15:26:24 -05:00
|
|
|
]],
|
|
|
|
}, -- HOOK_DISCONNECT
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|