Making 'Lists' In Config!

Discussion in 'Plugin Development' started by -_Husky_-, Feb 28, 2012.

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

    -_Husky_-

    Just wondering How do i make Lists. Like..

    Players:
    noob1
    noob2
    noob3

    and then Grab them from code like:

    String noobs = config.getString("Players"); ?
     
    RobotA69 likes this.
  2. Offline

    RobotA69

    I was also wondering about this (but with item ids)!
     
  3. Offline

    -_Husky_-

    Anyone.
     
  4. Offline

    kumpelblase2

    tried :
    Code:
    List<String> players = config.getStringList("Players");
    ?
     
  5. Offline

    Lolmewn Retired Staff

    Try
    Code:
    for (String key : config.getConfigurationSection("Players").getKeys(false)) {
     
  6. Offline

    JayEffKay

    I've tested a bit with lists (in lists) with the config, and this is what I understand from it:

    This is a real list and should work if your config looks like this :
    Code:
    Players:
        - noob1
        - noob2
        - noob3
    
    (bout yml lists)



    This returns all keys of a section should work if you config looks like this (however you don't read the values behind the keys in this loop):
    Code:
    Players:
        noob1: somethinghere
        noob2: whateveryoulike
        noob3: itwontbeusedthough
    
     
    fromgate likes this.
  7. Offline

    Lolmewn Retired Staff

    @JayEffKey oh ye, you're right. My code is useless for this question.
     
  8. Offline

    -_Husky_-

    Thanks a lot Guys! will try these Soon! I <3 The Bukkit Community!
     
Thread Status:
Not open for further replies.

Share This Page