Cuberite Forum
Lua hooks needed! - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Lua hooks needed! (/thread-464.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Lua hooks needed! - xoft - 02-18-2013

I think the client sends the Move packet about once a second even when the player is not moving at all; MCServer updates position upon receiving that packet and thus calls PLAYER_MOVED-hook every tick. You'll need to work around that, I don't think we'll be changing that behavior.


RE: Lua hooks needed! - NiLSPACE - 02-20-2013

can you add a HOOK_COMMAND that will be called whenever a player uses a command?


RE: Lua hooks needed! - NiLSPACE - 02-20-2013

and if you have return true the player wont be able to use a command, but also a way that he can use a command. i need that for a login plugin i am making. that someone only can use /login and /register when he logs in.


RE: Lua hooks needed! - xoft - 02-20-2013

The problem with commands is, no-one besides the plugin knows if the text specified really is a command or not.
Each command handler returns true if the command is handled, false if not; and only after handler returning true does MCServer know that it has really been a command.

Yes, we can plug something in that would fire on anything that *looks* like a command. But that feels wrong.


RE: Lua hooks needed! - NiLSPACE - 02-20-2013

can't you do somthing that it respons to everything with a / before it? if not how would you forbid a player to use a command?


RE: Lua hooks needed! - xoft - 02-20-2013

Yes, that's possible, but if a plugin registers a command without the slash, that command will still be usable because the hook wouldn't fire for it. That's the "feels wrong" I was talking about.


RE: Lua hooks needed! - NiLSPACE - 02-20-2013

so then, whats the best way to refuse a command exept for a few? maybe you can do something like Player:RemovePermissions() and that he has no permissions left and that you can do Player:AddPermission("login.register") to make him able to use some other commands. after he did /login i can do Player:LoadPermissionsFromDisk() so he has his normal permissions again.


RE: Lua hooks needed! - xoft - 02-20-2013

Hmm, there may be a way, let me check it first Smile


RE: Lua hooks needed! - NiLSPACE - 02-20-2013

thanks Smile


RE: Lua hooks needed! - FakeTruth - 02-21-2013

For what reason do you want to forbid a player to use any commands?

If it's some kind of login system you should just make sure all players start out in a group with no permissions, that way they can only use commands that do not need permissions (these are most likely harmless anyway)