diff options
author | Lukas Pioch <lukas@zgow.de> | 2017-06-12 12:59:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-12 12:59:46 +0200 |
commit | 9b0eb118b3a9c7f682176bbc033fbc0a515636f4 (patch) | |
tree | 9e0c61ccebce846e1a4a4f71dee5e67366702dd8 /Server/Plugins | |
parent | APIDoc: Corrected param in cBoat:MaterialToString (diff) | |
download | cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.tar cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.tar.gz cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.tar.bz2 cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.tar.lz cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.tar.xz cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.tar.zst cuberite-9b0eb118b3a9c7f682176bbc033fbc0a515636f4.zip |
Diffstat (limited to 'Server/Plugins')
-rw-r--r-- | Server/Plugins/InfoReg.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Server/Plugins/InfoReg.lua b/Server/Plugins/InfoReg.lua index a605507de..1e2b3c818 100644 --- a/Server/Plugins/InfoReg.lua +++ b/Server/Plugins/InfoReg.lua @@ -59,7 +59,7 @@ local function MultiCommandHandler(a_Split, a_Player, a_CmdString, a_CmdInfo, a_ -- A verb was specified, look it up in the subcommands table: local Subcommand = a_CmdInfo.Subcommands[Verb] if (Subcommand == nil) then - if (a_Level > 1) then + if (a_Level + 1 > 1) then -- This is a true subcommand, display the message and make MCS think the command was handled -- Otherwise we get weird behavior: for "/cmd verb" we get "unknown command /cmd" although "/cmd" is valid if (a_Player == nil) then @@ -81,13 +81,14 @@ local function MultiCommandHandler(a_Split, a_Player, a_CmdString, a_CmdInfo, a_ end end - -- If the handler is not valid, check the next sublevel: - if (Subcommand.Handler == nil) then - if (Subcommand.Subcommands == nil) then - LOG("Cannot find handler for command " .. a_CmdString .. " " .. Verb) - return false - end + -- First check if the subcommand has subcommands + if (Subcommand.Subcommands ~= nil) then + -- Next sublevel return MultiCommandHandler(a_Split, a_Player, a_CmdString .. " " .. Verb, Subcommand, a_Level + 1, a_EntireCommand) + elseif (Subcommand.Handler == nil) then + -- Subcommand has no subcommands and the handler is not found, report error + LOGWARNING("Cannot find handler for command " .. a_CmdString .. " " .. Verb) + return false end -- Execute: |