summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSTRWarrior <niels.breuker@hotmail.nl>2014-03-15 20:33:34 +0100
committerSTRWarrior <niels.breuker@hotmail.nl>2014-03-15 20:33:34 +0100
commitdb73e37e2d9261a1ec27964ee453f7c59312af79 (patch)
treed2124a588f37515e600918ae896c4bba29837131
parentDebuggers: Added a test for WE selection API. (diff)
downloadcuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.tar
cuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.tar.gz
cuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.tar.bz2
cuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.tar.lz
cuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.tar.xz
cuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.tar.zst
cuberite-db73e37e2d9261a1ec27964ee453f7c59312af79.zip
-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..0fa542bb8
--- /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") or 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