Don't cancel the task when they move, just remove them from the hashset. Also, you should probably be hashing player names instead of players, but maybe doesn't matter for such a temporary list - well that is assuming you clear the hashset when your timer goes off. Er... wait.. you're using a separate task for each player, i didn't realize that. So you *do* want to cancel the task- but you also need to be storing a task ID per player. I think you need to change your HashSet to a HashMap<String, id> - where the value is the task id. Then when a player moves, look up their own task id and cancel that one. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
NathanWolf Sorry but using "id" in a HashMap states that the variable cannot be found? http://prntscr.com/2ap11h
*facepalm* Well you need to store ofc. an Integer. But the value that you asign to it will be the ID of the Task