how to store StringLists

Discussion in 'Spigot Plugin Development' started by TheGamerPlayz, May 22, 2016.

  1. How would I store a string list in a config?
     
  2. Please elaborate.
     
  3. I am trying to store a list of player names in Teams.Red, this list will then be put into an arraylist to teleport the players in the list.
     
  4. Code (Java):
    List<String> list = new ArrayList<String>(); // Creating list
    list.add("One"); // Adding some strings in it.
    list.add("Two");

    getConfig().set("List", list); // Replace "List" with your path.
    saveConfig();
    This will make config looks like this:

    Code (YAML):
    List:
    - 'One'
    - 'Two'