List of players in config

Discussion in 'Plugin Development' started by Threehundredcc2, Jul 12, 2013.

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

    Threehundredcc2

    I was wondering how this could be done in a config.yml

    Code:
    players:
    name1
    name2
    name3
     
  2. Offline

    ZeusAllMighty11

    Set the arraylist into the config.

    getConfig().set("players", somelist);
     
  3. Offline

    Threehundredcc2

    TheGreenGamerHD
    How would I set the arraylist?
     
  4. Offline

    Cronos79

    Code:java
    1. List<String> somelist = new ArrayList<String>();
    2. somelist.add("playersName")
    3. somelist.add("anothername")
    4.  
    5. getConfig().set("players", somelist);
    6.  
    7. not sure 100% if that works didn't really type it in a ide..
    8. But that's what he was telling you
    9.  
    10. you could do it like
    11. for (Player player : Bukkit.getOnlinePlayers())
    12. {
    13. somelist.add(player.getName());
    14. }
     
Thread Status:
Not open for further replies.

Share This Page