Solved Loop through a config list?

Discussion in 'Plugin Development' started by j_boy1234, May 4, 2015.

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

    j_boy1234

    Hi, Is there a way i can make something run for each value in a config list?

    I mean by config list like:

    List:
    - value
    - value 2
    etc
     
  2. Offline

    mythbusterma

    @j_boy1234

    ConfigurationSection#getStringList(...) assuming they're Strings.
     
  3. Offline

    j_boy1234

    How would you put that in a for loop?
     
  4. Code:
    List<Object> listobjects = /Object list/
    for(Object object : listobjects) {
    //Stuff
    }
    
     
  5. Offline

    j_boy1234

    What? That wouldent get it from the config..?
     
  6. He was giving an example. "/Object list/" refers to the List from the config, obtained using mythbusterma's comment.
     
  7. Offline

    j_boy1234

    Sorry im confused could someone put it together..
     
  8. config.getStringList("key") returns a List<String>. Loop through it with
    Code:
    for (String line : theList) {
    where theList will be the List<String> as I said above
    Or just
    Code:
    for (String line : config.getStringList("key")) {
    If you can't even use the basics like a for-loop, I suggest you learning more java before starting into making bukkit plugins.
     
  9. Offline

    j_boy1234

    Oh wow i feal dumb now, thanks :D
     
Thread Status:
Not open for further replies.

Share This Page