summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/HookNotify
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-08-26 10:58:51 +0200
committerMattes D <github@xoft.cz>2015-09-05 22:01:21 +0200
commitdac97826f7d0c9b9135c1a08c4d5f16b61494bd1 (patch)
treeec17a9703fe734956e4f151cb5306befc4fd7571 /MCServer/Plugins/HookNotify
parentMerge pull request #2459 from cuberite/fixes (diff)
downloadcuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.gz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.bz2
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.lz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.xz
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.tar.zst
cuberite-dac97826f7d0c9b9135c1a08c4d5f16b61494bd1.zip
Diffstat (limited to 'MCServer/Plugins/HookNotify')
-rw-r--r--MCServer/Plugins/HookNotify/HookNotify.lua65
1 files changed, 0 insertions, 65 deletions
diff --git a/MCServer/Plugins/HookNotify/HookNotify.lua b/MCServer/Plugins/HookNotify/HookNotify.lua
deleted file mode 100644
index 411dbebbd..000000000
--- a/MCServer/Plugins/HookNotify/HookNotify.lua
+++ /dev/null
@@ -1,65 +0,0 @@
-
--- HookNotify.lua
-
---[[
-Implements the entire plugin
-
-NOTE: This plugin is not meant for production servers. It is used mainly by developers to verify that things
-are working properly when implementing MCServer features. Do not enable this plugin on production servers!
-
-This plugin logs a notification for each hook that is being called by the server.
-The TICK and WORLD_TICK hooks are disabled because they produce too much output.
---]]
-
-
-
-
-
-function Initialize(a_Plugin)
- -- Notify the admin that HookNotify is installed, this is not meant for production servers
- LOGINFO("HookNotify plugin is installed, beware, the log output may be quite large!");
- LOGINFO("You want this plugin enabled only when developing another plugin, not for regular gameplay.");
-
- -- These hooks will not be notified:
- local hooksToIgnore =
- {
- ["HOOK_TICK"] = true, -- Too much spam
- ["HOOK_WORLD_TICK"] = true, -- Too much spam
- ["HOOK_TAKE_DAMAGE"] = true, -- Has a separate handler with more info logged
- ["HOOK_MAX"] = true, -- No such hook, placeholder only
- ["HOOK_NUM_HOOKS"] = true, -- No such hook, placeholder only
- }
-
- -- Add all hooks:
- for n, v in pairs(cPluginManager) do
- if (n:match("HOOK_.*")) then
- if not(hooksToIgnore[n]) then
- LOG("Adding notification for hook " .. n .. " (" .. v .. ").")
- cPluginManager.AddHook(v,
- function (...)
- LOG(n .. "(")
- for i, param in ipairs(arg) do
- LOG(" " .. i .. ": " .. tolua.type(param) .. ": " .. tostring(param))
- end
- LOG(")");
- end -- hook handler
- ) -- AddHook
- end -- not (ignore)
- end -- n matches "HOOK"
- end -- for cPluginManager{}
-
- -- OnTakeDamage has a special handler listing the details of the damage dealt:
- cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE,
- function (a_Receiver, a_TDI)
- -- a_Receiver is cPawn
- -- a_TDI is TakeDamageInfo
-
- LOG("OnTakeDamage(): " .. a_Receiver:GetClass() .. " was dealt RawDamage " .. a_TDI.RawDamage .. ", FinalDamage " .. a_TDI.FinalDamage .. " (that is, " .. (a_TDI.RawDamage - a_TDI.FinalDamage) .. " HPs covered by armor)");
- end
- )
-
- return true
-end
-
-
-