1
0

InfoReg: Fixed cPluginManager usage.

This commit is contained in:
Mattes D 2016-09-16 16:30:52 +02:00
parent 7f8a4eb726
commit 26769c6113

View File

@ -129,14 +129,14 @@ function RegisterPluginInfoCommands()
else else
HelpString = "" HelpString = ""
end end
cPluginManager.BindCommand(CmdName, info.Permission or "", Handler, HelpString) cPluginManager:BindCommand(CmdName, info.Permission or "", Handler, HelpString)
-- Register all aliases for the command: -- Register all aliases for the command:
if (info.Alias ~= nil) then if (info.Alias ~= nil) then
if (type(info.Alias) == "string") then if (type(info.Alias) == "string") then
info.Alias = {info.Alias} info.Alias = {info.Alias}
end end
for idx, alias in ipairs(info.Alias) do for idx, alias in ipairs(info.Alias) do
cPluginManager.BindCommand(a_Prefix .. alias, info.Permission or "", Handler, HelpString) cPluginManager:BindCommand(a_Prefix .. alias, info.Permission or "", Handler, HelpString)
-- Also copy the alias's info table as a separate subcommand, -- 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 -- 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. -- than the one we're currently iterating and join after the iterating.
@ -181,7 +181,7 @@ function RegisterPluginInfoConsoleCommands()
return MultiCommandHandler(a_Split, nil, CmdName, info, a_Level, a_EntireCommand) return MultiCommandHandler(a_Split, nil, CmdName, info, a_Level, a_EntireCommand)
end end
end end
cPluginManager.BindConsoleCommand(CmdName, Handler, info.HelpString or "") cPluginManager:BindConsoleCommand(CmdName, Handler, info.HelpString or "")
-- Recursively register any subcommands: -- Recursively register any subcommands:
if (info.Subcommands ~= nil) then if (info.Subcommands ~= nil) then
RegisterSubcommands(a_Prefix .. cmd .. " ", info.Subcommands, a_Level + 1) RegisterSubcommands(a_Prefix .. cmd .. " ", info.Subcommands, a_Level + 1)