show list strings in config.yml

Discussion in 'Plugin Development' started by pt1448, Jun 19, 2013.

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

    pt1448

    Hi, I'm new to programming bukkit plugins and I need help with this. Here is an example config:

    Code:
    examplelist:
      derp:
        id: "roflderp"
      rofl:
        id: "derp"
      
    How do I make it so that it will display the "id" when you add more to it? I am sorry if this is a noob question.
     
  2. Offline

    gokarter24

    where do you want to display the id?
     
  3. Offline

    Jake0oo0

    ArrayList<String> list = new ArrayList<String>();
    list = getConfig().getStringList("exampleList.derp");
    for(String s : list){
    p.sendMessage(s);
    }
     
  4. Offline

    bitWolfy

    pt1448 Do you mean this:
    Code:
    String str = plugin.getConfig().getString("examplelist.derp.id");
     
  5. Offline

    pt1448

    Jake0oo0 bitWolfy Sorry to forget to add this, but how do I allow it to recognize it when users add more the config? That's pretty much the point of it.

    Bump?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  6. Offline

    Wingzzz

    You would need to parse the config ie: during the onEnable() just make sure the configuration is initialized and then grab the list then go over it's contents and use them as needed (store them or simply call every time directly to the config).
     
Thread Status:
Not open for further replies.

Share This Page