Solved Lists in config file.

Discussion in 'Spigot Plugin Development' started by black_, Apr 24, 2017.

  1. Hello SpigotMC. I need your help with something. In my config.yml file, I want there to be a list of lines:

    message:
    - "Welcome to the server!"
    - "Random"
    - "More randomness"

    That way someone who sets up the plugin can add or remove lines the way they see fit.
    I believe you do this with "list string" or something of the sort, can someone clarify.

    Thanks!
     
  2. Found this in an older thread on the forum. Try it:

     
    • Agree Agree x 1
    • Friendly Friendly x 1
  3. This is correct, here is a non quote for people seeing this later:
    Code (Text):
    for(String msg : getConfig().getStringList("someStringList"))
    {
        p.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
    }
     
    • Useful Useful x 1
  4. thank you both for the help
     
    • Friendly Friendly x 2

  5. Quick question. Where would this go?

    I would like it were the TODO is.
    http://i.imgur.com/B2SlPMX.png

    Sorry if this is amateur question.
     
  6. Just put it where you want to send the message. :)
     
    • Like Like x 1
    • Agree Agree x 1