I am making a plugin where when someone moves in the duration of the 10 seconds the teleportation cancels I'm trying to cancel the task on PlayerMoveEvent. I figured out how to check when a player has moved but need help with cancelling the task.
Move event is also fired when the player moves the camera. It would also be a massive overhead as you would need to run checks on each player per each movement. Instead, you can run the task in second intervals and check on each run if the player's distance from the origin position has met the threshold for the teleportation to be canceled.
You can try to create a function in your task to stop it like: public function stop(): void{ \\stop the task here } and in your Main you could do: $mytask = new MyTaskName(); $mytask->stop();
The comment line in your code is exactly what he is trying to do. He wants exactly that part of the code.