How to create variable for each player

Discussion in 'Spigot Plugin Development' started by ImWazzix, May 16, 2016.

  1. Hi, I'm a french nooby dev, and here is my code : http://pastebin.com/40X8kZ9v .
    I'm using a ActionBarAPI but anyway, I want for each choosed players do my void with their own timer and task, please I need help !
     
  2. wat
     
    • Agree Agree x 1
  3. We need a "Wat" Rating, i feel itd be overused though lmao
     
    • Like Like x 1
    • Agree Agree x 1
    • Funny Funny x 1
  4. i know, lmao. 940% of the things posted on these forums i dont unserstand for example somone once said:
    "me player sotre loop for list update."
     
    • Funny Funny x 3
  5. I'm french and my written english is not very technical, i want for each player to do a void with their own timer and task, but i can't declare and use them in the same void because of the scheduler I think : http://prntscr.com/b4qnw7
     
  6. I'm not sure what it is you're asking but maybe you're trying to make a enhanced for loop, ex;

    For(Player p : Bukkit.getOnlinePlayers())
    //do something
     
    • Agree Agree x 1
  7. loop through all the players with a for loop
    e.g. for player : player allPlayers {
    doMethod();
    }

    ^^
    Sniped @NickMD
     
  8. You don't understand xD, when a player do /rad ImWazzix i want to do the void, when i'm doing my void and do again the command with another player we will had the same timer and the same task i want to separate them !
     
  9. what is doing a void?
     
  10. use BukkitRunnable

    runTimer(Player){
    new BukkitRunnable(){
    //Add unimplemented methodss urself

    }
    }

    then when you do runTimer(player) it will make a new bukkit runnable giving it the players data.
     
  11. he means a method e.g. public void method()
     
  12. @ProJoosh I feel like we have to make that a trend now
     
    • Like Like x 1
  13. You have my code so just check it and tell me !
     
  14. i did tell you..
     
  15. Can i do a scheduler in my runnable ?
     
  16. holy...
     
    • Like Like x 1
  17. a runnable is a repeating task which you set aan interval with .runTaskTimer(plugin, 20L, 20L); and it repeates every that value so 20L will be 1 second.