.

Discussion in 'Plugin Development' started by elementalgodz11, Dec 12, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    elementalgodz11

  2. Offline

    NathanWolf

    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.
     
    Last edited by a moderator: Jun 5, 2016
  3. Offline

    elementalgodz11

    NathanWolf
    Sorry but using "id" in a HashMap states that the variable cannot be found?
    http://prntscr.com/2ap11h
     
  4. Offline

    L33m4n123

    *facepalm* Well you need to store ofc. an Integer. But the value that you asign to it will be the ID of the Task
     
Thread Status:
Not open for further replies.

Share This Page