Solved ConfigurationSection to string

Discussion in 'Spigot Plugin Development' started by Nicbo, Feb 11, 2020.

  1. Hey guys,

    So I'm working on a config command for a minigame plugin and one of the commands will show how the game is configured.

    upload_2020-2-11_12-0-17.png

    Just wondering if there is an easy way to have a configurationsection made into a string/string list like the one above.
     
  2. FIleConfiguration#getStringList
    FileConfiguration#set(List<String>)
     
  3. You can read lines from the file using a BufferedReader
     
    • Useful Useful x 1
  4. u cann use ArrayLists to u Fileconfiguration

    example
    Code (Text):
            List<String> list = new ArrayList();
            list.add("line1");
            list.add("line2");
            cfg.addDefault("ABC.TEST.COMMAND", list);
     
  5. I think he wants to take the text in the file and print that in chat, not add a list to the file.
    Adding to what I mentioned before, here are some examples: https://www.journaldev.com/709/java-read-file-line-by-line
     
    • Like Like x 1
    • Creative Creative x 1
  6. but Arraylist on Config is easier or not? :D
     
  7. No

    Loop through your configuration section and getting the values and use a string builder.
    I'm gonna post a code later.