summaryrefslogtreecommitdiffstats
path: root/MCServer
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-04 20:42:31 +0100
committermadmaxoft <github@xoft.cz>2014-01-04 20:42:31 +0100
commitb2ac22706414c296edf726ebd7f2865696964fb9 (patch)
treeafbbd60d3890d07abb8e088d061dc2f7dffccfe2 /MCServer
parentInfoDump: Implemented list and formatting Forumizing. (diff)
downloadcuberite-b2ac22706414c296edf726ebd7f2865696964fb9.tar
cuberite-b2ac22706414c296edf726ebd7f2865696964fb9.tar.gz
cuberite-b2ac22706414c296edf726ebd7f2865696964fb9.tar.bz2
cuberite-b2ac22706414c296edf726ebd7f2865696964fb9.tar.lz
cuberite-b2ac22706414c296edf726ebd7f2865696964fb9.tar.xz
cuberite-b2ac22706414c296edf726ebd7f2865696964fb9.tar.zst
cuberite-b2ac22706414c296edf726ebd7f2865696964fb9.zip
Diffstat (limited to 'MCServer')
-rw-r--r--MCServer/Plugins/InfoDump.lua33
1 files changed, 31 insertions, 2 deletions
diff --git a/MCServer/Plugins/InfoDump.lua b/MCServer/Plugins/InfoDump.lua
index 1b27abef4..8adf4fea2 100644
--- a/MCServer/Plugins/InfoDump.lua
+++ b/MCServer/Plugins/InfoDump.lua
@@ -173,6 +173,32 @@ end
+--- Writes the specified command detailed help array to the output file, in the forum dump format
+local function WriteCommandDetailedHelpForum(a_CmdString, a_DetailedHelp, f)
+ assert(type(a_CmdString) == "string");
+ assert(type(a_DetailedHelp) == "table");
+ assert(f ~= nil);
+
+ if (#a_DetailedHelp == 0) then
+ -- No explicit parameter combinations to write
+ return;
+ end
+
+ f:write("The following parameter combinations are recognized:\n");
+ for idx, combination in ipairs(a_DetailedHelp) do
+ f:write("[color=blue]", a_CmdString, "[/color] [color=green]", combination.Params, "[/color] - ", combination.Help);
+ if (combination.Permission ~= nil) then
+ f:write(" (Requires permission '[color=red]", combination.Permission, "[/color]')");
+ end
+ f:write("\n");
+ end
+end
+
+
+
+
+
+--- Writes all commands in the specified category to the output file, in the forum dump format
local function WriteCommandsCategoryForum(a_Category, f)
-- Write category name:
local CategoryName = a_Category.Name;
@@ -189,13 +215,16 @@ local function WriteCommandsCategoryForum(a_Category, f)
-- Write commands:
f:write("\n[list]");
for idx2, cmd in ipairs(a_Category.Commands) do
- f:write("\nCommand: [b]", cmd.CommandString, "[/b] - ", (cmd.Info.HelpString or "UNDOCUMENTED"), "\n");
+ f:write("\n[b]", cmd.CommandString, "[/b] - ", (cmd.Info.HelpString or "UNDOCUMENTED"), "\n");
if (cmd.Info.Permission ~= nil) then
- f:write("Permission required: ", cmd.Info.Permission, "\n");
+ f:write("Permission required: [color=red]", cmd.Info.Permission, "[/color]\n");
end
if (cmd.Info.DetailedDescription ~= nil) then
f:write(cmd.Info.DetailedDescription);
end
+ if (cmd.Info.DetailedHelp ~= nil) then
+ WriteCommandDetailedHelpForum(cmd.CommandString, cmd.Info.DetailedHelp, f);
+ end
end
f:write("[/list]\n\n")
end