diff options
author | Mattes D <github@xoft.cz> | 2015-05-11 10:39:45 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-05-11 10:39:45 +0200 |
commit | 7d66162e3c339e82d56e5144d466cab97eca82ab (patch) | |
tree | 5f3f1a00f704c7def6fc18b98c296e964f218815 /MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua | |
parent | Merge pull request #1977 from mc-server/warnings (diff) | |
parent | APIDump: Added linkification to hook return values. (diff) | |
download | cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.gz cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.bz2 cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.lz cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.xz cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.tar.zst cuberite-7d66162e3c339e82d56e5144d466cab97eca82ab.zip |
Diffstat (limited to '')
-rw-r--r-- | MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua b/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua index dadc4e94f..79b7bb055 100644 --- a/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua +++ b/MCServer/Plugins/APIDump/Hooks/OnExecuteCommand.lua @@ -2,7 +2,10 @@ return { HOOK_EXECUTE_COMMAND = { - CalledWhen = "A player executes an in-game command, or the admin issues a console command. Note that built-in console commands are exempt to this hook - they are always performed and the hook is not called.", + CalledWhen = [[ + A player executes an in-game command, or the admin issues a console command. Note that built-in + console commands are exempt to this hook - they are always performed and the hook is not called. + ]], DefaultFnName = "OnExecuteCommand", -- also used as pagename Desc = [[ A plugin may implement a callback for this hook to intercept both in-game commands executed by the @@ -11,17 +14,25 @@ return server.</p> <p> If the command is in-game, the first parameter to the hook function is the {{cPlayer|player}} who's - executing the command. If the command comes from the server console, the first parameter is nil. + executing the command. If the command comes from the server console, the first parameter is nil.</p> + <p> + The server calls this hook even for unregistered (unknown) console commands. However, it doesn't call + the hook for unregistered in-game commands, simply because there's no way to distinguish between a + command and a chat message. If a plugin needs to intercept unknown in-game commands, it should use the + {{OnChat|HOOK_CHAT}} hook. ]], Params = { { Name = "Player", Type = "{{cPlayer}}", Notes = "For in-game commands, the player who has sent the message. For console commands, nil" }, - { Name = "Command", Type = "table of strings", Notes = "The command and its parameters, broken into a table by spaces" }, + { Name = "CommandSplit", Type = "array-table of strings", Notes = "The command and its parameters, broken into a table by spaces" }, + { Name = "EntireCommand", Type = "string", Notes = "The entire command as a single string" }, }, Returns = [[ - If the plugin returns true, the command will be blocked and none of the remaining hook handlers will - be called. If the plugin returns false, MCServer calls all the remaining hook handlers and finally - the command will be executed. + If the plugin returns false, MCServer calls all the remaining hook handlers and finally the command + will be executed. If the plugin returns true, the none of the remaining hook handlers will be called. + In this case the plugin can return a second value, specifying whether what the command result should + be set to, one of the {{cPluginManager#CommandResult|CommandResult}} constants. If not + provided, the value defaults to crBlocked. ]], }, -- HOOK_EXECUTE_COMMAND } |