Added HOOK_EXECUTE_COMMAND for intercepting executed commands and console commands.
Note that built-in console commands are exempt to this hook - they are always performed and the hook is not called. Also note that, for reasons unknown, the HookNotify plugin doesn't list the callback arguments. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1221 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -23,6 +23,7 @@ function Initialize(Plugin)
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_COLLECTING_PICKUP);
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE);
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT);
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_EXECUTE_COMMAND);
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE);
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING);
|
||||
PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN);
|
||||
@@ -174,6 +175,21 @@ end
|
||||
|
||||
|
||||
|
||||
function OnExecuteCommand(...)
|
||||
LogHook("OnExecuteCommand", unpack(arg));
|
||||
|
||||
-- For some reason logging doesn't work for this callback, so list some stuff manually to verify:
|
||||
LOG("arg1 type: " .. type(arg[1]));
|
||||
if (arg[1] ~= nil) then
|
||||
LOG("Player name: " .. arg[1]:GetName());
|
||||
end
|
||||
LOG("Command: " .. arg[2][1]);
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function OnHandshake(...)
|
||||
LogHook("OnHandshake", unpack(arg));
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user