How do i detect if a player is moving Cuz when he moves it will cancel a task Im making a hub plugin btw
Duplicate? https://forums.pmmp.io/threads/how-to-detect-when-player-not-moving.5593/#post-50167 You can listen to the PlayerMoveEvent and cancel the event. Edit: This will cancel the head rotation. maybe Player::setImmobile();?
I don't think he wants to cancel the movement, but rather the task, like in some warp plugins, or almost like an AFK system. I would save the task object in an array with and identifier for the player, like their name, as the key. When they move, get their name, retrieve the task if it exists, and cancel it.
That should work but it's currently bypassable since pmmp doesn't handle immobile flag (which makes it only a client-sided movement lock). An additional PlayerMoveEvent-cancel-when-immobile check would do.