diff options
author | madmaxoft <github@xoft.cz> | 2013-08-21 21:42:39 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-21 21:42:39 +0200 |
commit | e9583b3e811992539fd152c0344225beae3bdf7f (patch) | |
tree | 91b4b0d1b5d3d3f787bfa76ffd18738fe308e2f5 /MCServer/Plugins/Debuggers | |
parent | cPluginManager.AddHook old-style API usage prints the stack trace. (diff) | |
download | cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.tar cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.tar.gz cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.tar.bz2 cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.tar.lz cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.tar.xz cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.tar.zst cuberite-e9583b3e811992539fd152c0344225beae3bdf7f.zip |
Diffstat (limited to 'MCServer/Plugins/Debuggers')
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 90a897aa6..599b8a3a3 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -16,15 +16,21 @@ function Initialize(Plugin) Plugin:SetName("Debuggers") Plugin:SetVersion(1) - PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_TICK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_WORLD_TICK); - + --[[ + -- Test multiple hook handlers: + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick1); + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick2); + --]] + + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem); + cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage); + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick); + cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity); + cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick); + + PluginManager = cRoot:Get():GetPluginManager(); PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities"); PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "- Kills all the loaded entities"); PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "- Sets all your armor to blue wool"); @@ -415,6 +421,24 @@ end +function OnTick1() + -- For testing multiple hook handlers per plugin + LOGINFO("Tick1"); +end + + + + + +function OnTick2() + -- For testing multiple hook handlers per plugin + LOGINFO("Tick2"); +end + + + + + --- When set to a positive number, the following OnTick() will perform GC and decrease until 0 again GCOnTick = 0; |