Lua hooks needed!
#51
Thanks, didn't know about that.
Reply
Thanks given by:
#52
I played a while with HookNotify enabled and it seems that some actions should have their own hooks too:
- taking damage
- moving something in the inventory
- mob movement/attack hooks
- water/lava flowing
- blocks falling
Also onPlayerLeftClick is not firing when player is not looking at any block (it should - for things like WorldEdit).
Reply
Thanks given by:
#53
Yes, falling blocks and water/lava would be useful for me with BlockLogger.
Reply
Thanks given by:
#54
and fire might be usefull for anti-griefing?
Reply
Thanks given by:
#55
YeahTongue
Reply
Thanks given by:
#56
Luksor,
- Taking damage should have its hook, only its output is a bit different. That hook has been tested a while ago when I was implementing the damage value calculation (TakeDamageInfo rewrite, https://forum.cuberite.org/showthread.php?tid=625 ).
- Left click is triggerred everytime we get a packet from the client. If we don't get a packet, we cannot fire an event. You might want to check with ProtoProxy if the packet is being sent and somehow ignored in MCServer, but I doubt that. We don't even do the block interactions rate check before firing the event.
- Inventory manipulation is a good idea for hooks. Care to specify the API?
- Mob movement will definitely need to be covered, but I'd prefer to leave that until we have a decent mob AI, because then we might get a few extra events (OnMobTargetsPlayer() et al. )
- Water / lava flowing are kinda grey zone. The simulators are already slow and slowing them down even more with hooks would be quite dangerous. I know we might improve the simulator speed, but still this is about handling thousands, maybe tens of thousands hooks per second on a regular server.
- Blocks falling are a good idea. Even better, all entity operations - create entity, spawn entity, destroy entity - are good candidates for hooks. Unfortunately they might be a good source of deadlocks between plugins.

Generally, I'd like to first stabilize anything with the current set of hooks, then expand the set.
Reply
Thanks given by:
#57
For the inventory hooks, I think we should have hooks for inventory opening and closing, then Left click, right click and shift click hooks.
That way we could control every action player is making in the inventory, I'm not sure about other things like picking up items, bucket usage, item dropping etc. I think we also need a hook that triggers when inventory slot is about to be changed.
Reply
Thanks given by:
#58
So what do you think, is the hooks branch good enough to be merged into trunk? I think most plugins have already been rewritten, there haven't been too many reports of hooks not working, so I'd say it's good enough.
Reply
Thanks given by:
#59
Yeah I think it's good enough.
Reply
Thanks given by:
#60
Alrighty, merged in rev 1139.
Reply
Thanks given by:




Users browsing this thread: 9 Guest(s)