summaryrefslogtreecommitdiffstats
path: root/Server/Plugins
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2017-01-01 22:44:13 +0100
committerGitHub <noreply@github.com>2017-01-01 22:44:13 +0100
commit45ce828a168a96783c4c96bd18c3b3d5a3bfeee4 (patch)
tree0b5968bb872a04b949af74b6317b68b3f85da2d8 /Server/Plugins
parentFix crash after attempting to kill a non-running thread (#3504) (diff)
downloadcuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.tar
cuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.tar.gz
cuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.tar.bz2
cuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.tar.lz
cuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.tar.xz
cuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.tar.zst
cuberite-45ce828a168a96783c4c96bd18c3b3d5a3bfeee4.zip
Diffstat (limited to 'Server/Plugins')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua66
-rw-r--r--Server/Plugins/Debuggers/Info.lua6
2 files changed, 21 insertions, 51 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index 8e2bd0156..28b7e254d 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -54,7 +54,6 @@ function Initialize(a_Plugin)
-- TestBlockAreas()
-- TestSQLiteBindings()
-- TestExpatBindings()
- TestPluginCalls()
TestBlockAreasString()
TestStringBase64()
@@ -62,10 +61,6 @@ function Initialize(a_Plugin)
-- TestRankMgr()
TestFileExt()
-- TestFileLastMod()
- TestPluginInterface()
-
- local LastSelfMod = cFile:GetLastModificationTime(a_Plugin:GetLocalFolder() .. "/Debuggers.lua")
- LOG("Debuggers.lua last modified on " .. os.date("%Y-%m-%dT%H:%M:%S", LastSelfMod))
--[[
-- Test cCompositeChat usage in console-logging:
@@ -95,27 +90,6 @@ end;
-function TestPluginInterface()
- cPluginManager:DoWithPlugin("Core",
- function (a_CBPlugin)
- if (a_CBPlugin:GetStatus() == cPluginManager.psLoaded) then
- LOG("Core plugin was found, version " .. a_CBPlugin:GetVersion())
- else
- LOG("Core plugin is not loaded")
- end
- end
- )
-
- cPluginManager:ForEachPlugin(
- function (a_CBPlugin)
- LOG("Plugin in " .. a_CBPlugin:GetFolderName() .. " has an API name of " .. a_CBPlugin:GetName() .. " and status " .. a_CBPlugin:GetStatus())
- end
- )
-end
-
-
-
-
function TestFileExt()
assert(cFile:ChangeFileExt("fileless_dir/", "new") == "fileless_dir/")
assert(cFile:ChangeFileExt("fileless_dir/", ".new") == "fileless_dir/")
@@ -138,6 +112,9 @@ end
function TestFileLastMod()
+ local LastSelfMod = cFile:GetLastModificationTime(a_Plugin:GetLocalFolder() .. "/Debuggers.lua")
+ LOG("Debuggers.lua last modified on " .. os.date("%Y-%m-%dT%H:%M:%S", LastSelfMod))
+
local f = assert(io.open("test.txt", "w"))
f:write("test")
f:close()
@@ -150,31 +127,6 @@ end
-function TestPluginCalls()
- -- In order to test the inter-plugin communication, we're going to call Core's ReturnColorFromChar() function
- -- It is a rather simple function that doesn't need any tables as its params and returns a value, too
- -- Note the signature: function ReturnColorFromChar( Split, char ) ... return cChatColog.Gray ... end
- -- The Split parameter should be a table, but it is not used in that function anyway,
- -- so we can get away with passing nil to it.
-
- LOG("Debuggers: Calling NoSuchPlugin.FnName()...")
- cPluginManager:CallPlugin("NoSuchPlugin", "FnName", "SomeParam")
- LOG("Debuggers: Calling Core.NoSuchFunction()...")
- cPluginManager:CallPlugin("Core", "NoSuchFunction", "SomeParam")
- LOG("Debuggers: Calling Core.ReturnColorFromChar(..., \"8\")...")
- local Gray = cPluginManager:CallPlugin("Core", "ReturnColorFromChar", "split", "8")
- if (Gray ~= cChatColor.Gray) then
- LOGWARNING("Debuggers: Call failed, exp " .. cChatColor.Gray .. ", got " .. (Gray or "<nil>"))
- else
- LOG("Debuggers: Call succeeded")
- end
- LOG("Debuggers: Inter-plugin calls done.")
-end
-
-
-
-
-
function TestBlockAreas()
LOG("Testing block areas...");
@@ -1993,6 +1945,18 @@ end
+function HandleConsolePluginStats(a_Split)
+ cPluginManager:ForEachPlugin(
+ function (a_CBPlugin)
+ LOG("Plugin in " .. a_CBPlugin:GetFolderName() .. " has an API name of " .. a_CBPlugin:GetName() .. " and status " .. a_CBPlugin:GetStatus())
+ end
+ )
+ return true
+end
+
+
+
+
function HandleConsolePrepareChunk(a_Split)
-- Check params:
local numParams = #a_Split
diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua
index ea1a60a56..a29ab5995 100644
--- a/Server/Plugins/Debuggers/Info.lua
+++ b/Server/Plugins/Debuggers/Info.lua
@@ -290,6 +290,12 @@ g_PluginInfo =
HelpString = "Loads the specified chunk into memory",
},
+ ["pluginstats"] =
+ {
+ Handler = HandleConsolePluginStats,
+ HelpString = "Shows the stats for each plugin",
+ },
+
["preparechunk"] =
{
Handler = HandleConsolePrepareChunk,