summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-10 21:27:57 +0200
committerMattes D <github@xoft.cz>2014-05-10 21:27:57 +0200
commit28815252e6ff086c0fab7cf56be4839f3d8612a3 (patch)
tree4532e85cbcc873a2616147713e9f899ecf84d111 /MCServer
parentClient cert is not requested. (diff)
parentMerge pull request #993 from mc-server/GridStructGen (diff)
downloadcuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.gz
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.bz2
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.lz
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.xz
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.zst
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.zip
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/APIDump/Hooks/OnDisconnect.lua24
-rw-r--r--MCServer/Plugins/APIDump/main_APIDump.lua6
m---------MCServer/Plugins/Core0
3 files changed, 22 insertions, 8 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
}
diff --git a/MCServer/Plugins/APIDump/main_APIDump.lua b/MCServer/Plugins/APIDump/main_APIDump.lua
index 52199740b..a25bab9cf 100644
--- a/MCServer/Plugins/APIDump/main_APIDump.lua
+++ b/MCServer/Plugins/APIDump/main_APIDump.lua
@@ -27,10 +27,14 @@ local function LoadAPIFiles(a_Folder, a_DstTable)
-- We only want .lua files from the folder:
if (cFile:IsFile(FileName) and fnam:match(".*%.lua$")) then
local TablesFn, Err = loadfile(FileName);
- if (TablesFn == nil) then
+ if (type(TablesFn) ~= "function") then
LOGWARNING("Cannot load API descriptions from " .. FileName .. ", Lua error '" .. Err .. "'.");
else
local Tables = TablesFn();
+ if (type(Tables) ~= "table") then
+ LOGWARNING("Cannot load API descriptions from " .. FileName .. ", returned object is not a table (" .. type(Tables) .. ").");
+ break
+ end
for k, cls in pairs(Tables) do
a_DstTable[k] = cls;
end
diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core
-Subproject 013a32a7fb3c8a6cfe0aef892d4c7394d4e1be5
+Subproject 5c8557d4fdfa580c100510cde07a1a778ea2e24