summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-03-16 21:53:11 +0100
committerMattes D <github@xoft.cz>2014-03-16 21:53:11 +0100
commit728bfd155ec9976db0f8fb2ee3af28e0d1745309 (patch)
tree4bb9304b50546bee51c99cc32581809eb0a0781f
parentMerge pull request #782 from mc-server/beds (diff)
parentOnly check for "Info.lua" with capital I (diff)
downloadcuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.tar
cuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.tar.gz
cuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.tar.bz2
cuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.tar.lz
cuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.tar.xz
cuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.tar.zst
cuberite-728bfd155ec9976db0f8fb2ee3af28e0d1745309.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/DumpInfo/Init.lua49
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