From 27ce6dd97e3979a36318cea28e64c6a9029dbd99 Mon Sep 17 00:00:00 2001
From: madmaxoft
Date: Wed, 9 Oct 2013 10:24:24 +0200
Subject: [PATCH] APIDump: Added support for extra pages.
Referenced by file links and titles and copied directly from the plugin folder to the dest folder.
---
MCServer/Plugins/APIDump/APIDesc.lua | 6 +++
MCServer/Plugins/APIDump/WebWorldThreads.html | 8 ++++
MCServer/Plugins/APIDump/main.lua | 41 +++++++++++++++++--
3 files changed, 52 insertions(+), 3 deletions(-)
create mode 100644 MCServer/Plugins/APIDump/WebWorldThreads.html
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 6578e6d8b..7bef7bcfd 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -2063,6 +2063,12 @@ World:ForEachEntity(
"ReadDescriptions",
"WriteHtmlClass",
},
+
+ ExtraPages =
+ {
+ -- No sorting is provided for these, they will be output in the same order as defined here
+ { FileName = "WebWorldThreads.html", Title = "Webserver vs World threads" },
+ }
} ;
diff --git a/MCServer/Plugins/APIDump/WebWorldThreads.html b/MCServer/Plugins/APIDump/WebWorldThreads.html
new file mode 100644
index 000000000..1a593ad8d
--- /dev/null
+++ b/MCServer/Plugins/APIDump/WebWorldThreads.html
@@ -0,0 +1,8 @@
+
+
+Webserver vs World threads
+
+
+This is a temporary test
+
+
\ No newline at end of file
diff --git a/MCServer/Plugins/APIDump/main.lua b/MCServer/Plugins/APIDump/main.lua
index 92b0d150c..5dd6c6f9e 100644
--- a/MCServer/Plugins/APIDump/main.lua
+++ b/MCServer/Plugins/APIDump/main.lua
@@ -9,6 +9,7 @@
-- Global variables:
g_Plugin = nil;
+g_PluginFolder = "";
@@ -22,6 +23,8 @@ function Initialize(Plugin)
Plugin:SetVersion(1);
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
+
+ g_PluginFolder = Plugin:GetLocalFolder();
-- dump all available API functions and objects:
-- DumpAPITxt();
@@ -189,9 +192,15 @@ function DumpAPIHtml()
return;
end
- f:write([[MCServer API - class index
+ f:write([[MCServer API - index
-
MCServer API - class index
+
MCServer API - index
+
The API reference is divided into the following sections:
A plugin can register to be called whenever an “interesting event” occurs. It does so by calling
+ cPluginManager's AddHook() function and implementing a callback
+ function to handle the event.
+
A plugin can decide whether it will let the event pass through to the rest of the plugins, or hide it
+ from them. This is determined by the return value from the hook callback function. If the function returns
+ false or no value, the event is propagated further. If the function returns true, the processing is
+ stopped, no other plugin receives the notification (and possibly MCServer disables the default behavior
+ for the event). See each hook's details to see the exact behavior.
+
Hook name
Called when
+ ]]);
+ -- TODO: Write out the hooks into a table
+ f:write([[
The following pages provide various extra information
+
]]);
+ for i, extra in ipairs(g_APIDesc.ExtraPages) do
+ if (cFile:Copy(g_PluginFolder .. "/" .. extra.FileName, "API/" .. extra.FileName)) then
+ f:write("