diff options
author | Tycho <work.tycho+git@gmail.com> | 2014-04-02 15:05:55 +0200 |
---|---|---|
committer | Tycho <work.tycho+git@gmail.com> | 2014-04-02 15:05:55 +0200 |
commit | dcaea749ae502366c23f2c04f3b42882cb71d0d6 (patch) | |
tree | 56e499098895a03bc66beac5aa33ba4ee261f17e /MCServer/Plugins/DumpInfo | |
parent | Merge branch 'master' into globals (diff) | |
parent | Merge pull request #831 from mc-server/Wither (diff) | |
download | cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.gz cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.bz2 cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.lz cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.xz cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.tar.zst cuberite-dcaea749ae502366c23f2c04f3b42882cb71d0d6.zip |
Diffstat (limited to 'MCServer/Plugins/DumpInfo')
-rw-r--r-- | MCServer/Plugins/DumpInfo/Init.lua | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/MCServer/Plugins/DumpInfo/Init.lua b/MCServer/Plugins/DumpInfo/Init.lua new file mode 100644 index 000000000..5d9c752b0 --- /dev/null +++ b/MCServer/Plugins/DumpInfo/Init.lua @@ -0,0 +1,49 @@ +function Initialize(a_Plugin) + a_Plugin:SetName("DumpInfo") + a_Plugin:SetVersion(1) + + -- Check if the infodump file exists. + if (not cFile:Exists("Plugins/InfoDump.lua")) then + LOGWARN("[DumpInfo] InfoDump.lua was not found.") + return false + end + + -- Add the webtab. + a_Plugin:AddWebTab("DumpPlugin", HandleDumpPluginRequest) + return true +end + + + + + +function HandleDumpPluginRequest(a_Request) + local Content = "" + + -- Check if it already was requested to dump a plugin. + if (a_Request.PostParams["DumpInfo"] ~= nil) then + local F = loadfile("Plugins/InfoDump.lua") + F("Plugins/" .. a_Request.PostParams["DumpInfo"]) + end + + Content = Content .. [[ +<table> +<th colspan="2">DumpInfo</th>]] + + -- Loop through each plugin that is found. + for PluginName, k in pairs(cPluginManager:Get():GetAllPlugins()) do + + -- Check if there is a file called 'Info.lua' or 'info.lua' + if (cFile:Exists("Plugins/" .. PluginName .. "/Info.lua")) then + Content = Content .. "<tr>" + Content = Content .. "<td>" .. PluginName .. "</td>" + Content = Content .. "<td> <form method='POST'> <input type='hidden' value='" .. PluginName .. "' name='DumpInfo'> <input type='submit' value='DumpInfo'> </form>" + Content = Content .. "</td>" + end + end + + Content = Content .. [[ +</table>]] + + return Content +end |