From db73e37e2d9261a1ec27964ee453f7c59312af79 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 15 Mar 2014 20:33:34 +0100 Subject: Created a small plugin for InfoDump It allows you to dump the info of a plugin by pressing a button in the webadmin. --- MCServer/Plugins/DumpInfo/Init.lua | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 MCServer/Plugins/DumpInfo/Init.lua (limited to 'MCServer') 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 .. [[ + +]] + + -- 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 .. "" + Content = Content .. "" + Content = Content .. "" + end + end + + Content = Content .. [[ +
DumpInfo
" .. PluginName .. "
" + Content = Content .. "
]] + + return Content +end -- cgit v1.2.3 From 5ac863f7fa780329e9dbe4e087162e33e0b7213c Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 16 Mar 2014 18:45:01 +0100 Subject: Removed the @EnableMobDebug.lua file. It is not needed anymore, ZeroBrane Studio now has direct support for invoking the debugger in MCS plugins. --- MCServer/Plugins/@EnableMobDebug.lua | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 MCServer/Plugins/@EnableMobDebug.lua (limited to 'MCServer') diff --git a/MCServer/Plugins/@EnableMobDebug.lua b/MCServer/Plugins/@EnableMobDebug.lua deleted file mode 100644 index 48d4c36b7..000000000 --- a/MCServer/Plugins/@EnableMobDebug.lua +++ /dev/null @@ -1,29 +0,0 @@ - --- @EnableMobDebug.lua - --- Enables the MobDebug debugger, used by ZeroBrane Studio, for a plugin --- Needs to be named with a @ at the start so that it's loaded as the first file of the plugin - ---[[ -Usage: -Copy this file to your plugin's folder when you want to debug that plugin -You should neither check this file into the plugin's version control system, -nor distribute it in the final release. ---]] - - - - - --- Try to load the debugger, be silent about failures: -local IsSuccess, MobDebug = pcall(require, "mobdebug") -if (IsSuccess) then - MobDebug.start() - - -- The debugger will automatically put a breakpoint on this line, use this opportunity to set more breakpoints in your code - LOG(cPluginManager:GetCurrentPlugin():GetName() .. ": MobDebug enabled") -end - - - - -- cgit v1.2.3 From 4227066f6d564a0e816b190f2726f036bff5b34d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 16 Mar 2014 21:30:44 +0100 Subject: Fixed InfoReg.lua's handling of multi-level commands. --- MCServer/Plugins/InfoReg.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MCServer') diff --git a/MCServer/Plugins/InfoReg.lua b/MCServer/Plugins/InfoReg.lua index 1cf68dbed..b3717884a 100644 --- a/MCServer/Plugins/InfoReg.lua +++ b/MCServer/Plugins/InfoReg.lua @@ -59,13 +59,13 @@ local function MultiCommandHandler(a_Split, a_Player, a_CmdString, a_CmdInfo, a_ return true; end - -- Check if the handler is valid: + -- If the handler is not valid, check the next sublevel: if (Subcommand.Handler == nil) then if (Subcommand.Subcommands == nil) then LOG("Cannot find handler for command " .. a_CmdString .. " " .. Verb); return false; end - ListSubcommands(a_Player, Subcommand.Subcommands, a_CmdString .. " " .. Verb); + MultiCommandHandler(a_Split, a_Player, a_CmdString .. " " .. Verb, Subcommand, a_Level + 1); return true; end -- cgit v1.2.3 From 5a9f17060d09316931fd246e7b5f059a6bf4abac Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 16 Mar 2014 21:52:28 +0100 Subject: Only check for "Info.lua" with capital I --- MCServer/Plugins/DumpInfo/Init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer') diff --git a/MCServer/Plugins/DumpInfo/Init.lua b/MCServer/Plugins/DumpInfo/Init.lua index 0fa542bb8..5d9c752b0 100644 --- a/MCServer/Plugins/DumpInfo/Init.lua +++ b/MCServer/Plugins/DumpInfo/Init.lua @@ -34,7 +34,7 @@ function HandleDumpPluginRequest(a_Request) 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 + if (cFile:Exists("Plugins/" .. PluginName .. "/Info.lua")) then Content = Content .. "" Content = Content .. "" .. PluginName .. "" Content = Content .. "
" -- cgit v1.2.3