summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/DumpInfo
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-08-26 10:58:51 +0200
committerMattes D <github@xoft.cz>2015-09-05 22:01:21 +0200
commitdac97826f7d0c9b9135c1a08c4d5f16b61494bd1 (patch)
treeec17a9703fe734956e4f151cb5306befc4fd7571 /Server/Plugins/DumpInfo
parentMerge pull request #2459 from cuberite/fixes (diff)
downloadcuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.gz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.bz2
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.lz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.xz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.zst
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.zip
Diffstat (limited to 'Server/Plugins/DumpInfo')
-rw-r--r--Server/Plugins/DumpInfo/Init.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/Server/Plugins/DumpInfo/Init.lua b/Server/Plugins/DumpInfo/Init.lua
new file mode 100644
index 000000000..2c5998e36
--- /dev/null
+++ b/Server/Plugins/DumpInfo/Init.lua
@@ -0,0 +1,52 @@
+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>
+ <tr>
+ <th colspan="2">DumpInfo</th>
+ </tr>]]
+
+ -- Loop through each plugin that is found.
+ cPluginManager:Get():ForEachPlugin(
+ function(a_Plugin)
+ -- Check if there is a file called 'Info.lua'
+ if (cFile:Exists("Plugins/" .. a_Plugin:GetName() .. "/Info.lua")) then
+ Content = Content .. "\n<tr>\n"
+ Content = Content .. "\t<td>" .. a_Plugin:GetName() .. "</td>\n"
+ Content = Content .. "\t<td><form method='POST'> <input type='hidden' value='" .. a_Plugin:GetName() .. "' name='DumpInfo'> <input type='submit' value='DumpInfo'></form></td>\n"
+ Content = Content .. "</tr>\n"
+ end
+ end
+ )
+
+ Content = Content .. [[
+</table>]]
+
+ return Content
+end