Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 4,634
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
can you add a HOOK_COMMAND that will be called whenever a player uses a command?
Posts: 4,634
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
02-20-2013, 05:07 AM
(This post was last modified: 02-20-2013, 05:24 AM by NiLSPACE.)
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.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 4,634
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
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?
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
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.
Posts: 4,634
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
02-20-2013, 07:57 PM
(This post was last modified: 02-20-2013, 08:05 PM by NiLSPACE.)
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.
Posts: 1,450
Threads: 53
Joined: Feb 2011
Thanks: 15
Given 120 thank(s) in 91 post(s)
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)