Saving stuff in config

Discussion in 'Spigot Plugin Development' started by Jumbo_1907, Jun 2, 2017.

  1. Hey, I'm currently updating my quest plugin and I want to save the quests players have done already
    I want to save it like this:

    quest1: false
    quest2: true

    How is this possible?
    Any tutorials, Videos, ?
  2. That's the same.
    • Like Like x 1
  3. Have you already created the FileConfiguration? If so: Yaml separates this kind of paths with a dot. This means that if you use 'data.UUID.quest1' as path in for example config.get(path) you will get the values that are saved right there.

    Hope it helped!
  4. I know that but how can I add something to the list
  5. U have got 2 options:
    1. Add all quest they have done to a string list and save that
    2. You will have all quests with a Boolean wether they finished it.

    I would chose for option 1. Use list = config.getStringList("data.UUID") to obtain the list* and than you can do list.add("questnumber") and at last saving it by config.set("data.UUID", list)

    * Code needs cleanup but I expect you to be able to do that yourself

    If you want to use the second option: use config.set("data.UUID.questnumb", true), that will make a new section. However, in this case I would highly recommend you the first option.
    You also get the option to do list.contains("questnumber") to check if it is finished.

    Good luck with your plugin!