summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-25 18:15:09 +0100
committermadmaxoft <github@xoft.cz>2014-02-25 18:15:09 +0100
commit0d8ab184e0d52fe75cac31ae6fc403e28af685ba (patch)
treeb01a4469d6f2fc26709f31e1aadcbda1d82fb239 /MCServer/Plugins
parentAdded useful parameter overloads to cBlockArea Lua API. (diff)
downloadcuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.tar
cuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.tar.gz
cuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.tar.bz2
cuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.tar.lz
cuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.tar.xz
cuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.tar.zst
cuberite-0d8ab184e0d52fe75cac31ae6fc403e28af685ba.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/InfoReg.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/MCServer/Plugins/InfoReg.lua b/MCServer/Plugins/InfoReg.lua
index 3afb57488..1cf68dbed 100644
--- a/MCServer/Plugins/InfoReg.lua
+++ b/MCServer/Plugins/InfoReg.lua
@@ -85,6 +85,10 @@ function RegisterPluginInfoCommands()
local function RegisterSubcommands(a_Prefix, a_Subcommands, a_Level)
assert(a_Subcommands ~= nil);
+ -- A table that will hold aliases to subcommands temporarily, during subcommand iteration
+ local AliasTable = {}
+
+ -- Iterate through the subcommands, register them, and accumulate aliases:
for cmd, info in pairs(a_Subcommands) do
local CmdName = a_Prefix .. cmd;
local Handler = info.Handler;
@@ -112,15 +116,25 @@ function RegisterPluginInfoCommands()
end
for idx, alias in ipairs(info.Alias) do
cPluginManager.BindCommand(a_Prefix .. alias, info.Permission or "", Handler, HelpString);
+ -- Also copy the alias's info table as a separate subcommand,
+ -- so that MultiCommandHandler() handles it properly. Need to off-load into a separate table
+ -- than the one we're currently iterating and join after the iterating.
+ AliasTable[alias] = info
end
end
- end
+ end -- else (if Handler == nil)
-- Recursively register any subcommands:
if (info.Subcommands ~= nil) then
RegisterSubcommands(a_Prefix .. cmd .. " ", info.Subcommands, a_Level + 1);
end
+ end -- for cmd, info - a_Subcommands[]
+
+ -- Add the subcommand aliases that were off-loaded during registration:
+ for alias, info in pairs(AliasTable) do
+ a_Subcommands[alias] = info
end
+ AliasTable = {}
end
-- Loop through all commands in the plugin info, register each: