Cuberite Forum
Hook names - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Hook names (/thread-489.html)



Hook names - xoft - 06-13-2012

I find it rather confusing that hook names have an E_PLUGIN_ prefix. I'd like to rename them to use HOOK_ prefix instead, while keeping a copy of the old prefix for compatibility reasons. Newly created hooks will have only the HOOK_ prefix and no E_PLUGIN_ counterpart. What does the plugin community think about this?


RE: Hook names - Taugeshtu - 06-13-2012

I'm fine with that Smile


RE: Hook names - xoft - 06-13-2012

And any renaming to add consistency?


RE: Hook names - FakeTruth - 06-13-2012

Change the block place hook to right click or something?


RE: Hook names - xoft - 06-13-2012

We might want to consider two hooks, HOOK_RIGHT_CLICK and HOOK_BLOCK_PLACE. The one for rclk is called each time a player rclks; blockplace is called only when that rclk is translated into an actual block being placed. So using a hoe, for example, will trigger rclk, but not blockplace.

For this reason, I'm not inclined to just rename the hook, it needs deeper discussion.


RE: Hook names - Taugeshtu - 06-13-2012

My suggestion is to add right click as separate hook, and add left click as separate hook as well. Because, as I understand, MCS passes OnBlockDig only if it's within digging range, right?
And still, more hooks will make stuff clear Smile