summaryrefslogtreecommitdiffstats
path: root/Server/Plugins
diff options
context:
space:
mode:
authorLukas Pioch <lukas@zgow.de>2017-06-12 12:59:46 +0200
committerGitHub <noreply@github.com>2017-06-12 12:59:46 +0200
commit9b0eb118b3a9c7f682176bbc033fbc0a515636f4 (patch)
tree9e0c61ccebce846e1a4a4f71dee5e67366702dd8 /Server/Plugins
parentAPIDoc: Corrected param in cBoat:MaterialToString (diff)
downloadcuberite-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 '')
-rw-r--r--Server/Plugins/InfoReg.lua15
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: