summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-02 12:23:22 +0200
committermadmaxoft <github@xoft.cz>2014-05-02 12:35:35 +0200
commit13452d3ab92c1cc12201caf60782fd7f7c4314f7 (patch)
tree893850bb2c55d5e08a79026ec747497acaf4f244 /MCServer/Plugins
parentAPIDump: Improved error handling in API file loader. (diff)
downloadcuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.tar
cuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.tar.gz
cuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.tar.bz2
cuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.tar.lz
cuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.tar.xz
cuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.tar.zst
cuberite-13452d3ab92c1cc12201caf60782fd7f7c4314f7.zip
Diffstat (limited to 'MCServer/Plugins')
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua24
1 files changed, 17 insertions, 7 deletions
diff --git a/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua b/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua
index a3301a8c6..204cb63d2 100644
--- a/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua
+++ b/MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua
@@ -2,23 +2,33 @@ return
{
HOOK_DISCONNECT =
{
- CalledWhen = "A player has explicitly disconnected.",
+ CalledWhen = [[
+ A client has disconnected, either by explicitly sending the disconnect packet (in older protocols) or
+ their connection was terminated
+ ]],
DefaultFnName = "OnDisconnect", -- also used as pagename
Desc = [[
- This hook is called when a client is about to be disconnected from the server, for whatever reason.
-
- <p><b>Note that this hook will be removed after <1.7 protocol support is removed, as it was originally a hook for
- the client sending the server a disconnect packet, which no longer happens.</b></p>
+ 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.
]],
Params =
{
- { Name = "Player", Type = "{{cPlayer}}", Notes = "The player who has disconnected" },
+ { Name = "Client", Type = "{{cClientHandle}}", Notes = "The client who has disconnected" },
{ Name = "Reason", Type = "string", Notes = "The reason that the client has sent in the disconnect packet" },
},
Returns = [[
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,
- the player is disconnected.
+ the client is disconnected.
]],
}, -- HOOK_DISCONNECT
}