Getting multiple subvalues in a config

Discussion in 'Plugin Development' started by Taco, Mar 24, 2012.

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


    If I have a config as shown below

    'sub1': turtles​
    'sub2': bleh​
    'sub3': morevalues​

    How do I get a list of all those values? I want a list that would contain, in this example, "turtles, bleh, morevalues".
  2. Offline


    getKeys("main") would give you a list of the keys and values from "main".

    EDIT: I guess they changed how getKeys() is called, see below post.
  3. Offline


    List<String> subvaules = new ArrayList<String>();
    Set<String> keys = getConfig().getConfigurationSection("main").getKeys(false);
    for(Sting key : keys)
      subvalues.add(getConfig().get("main." + key));
    should work.
    zippy120 and Taco like this.
  4. Offline


    This is precisely what I needed. Thank you!
Thread Status:
Not open for further replies.

Share This Page