Solved Deleting YamlConfiguration Parts

Discussion in 'Spigot Plugin Development' started by N1ark, Jun 29, 2018.

  1. Hello!
    I am trying to save data in files, for each player, and because i just need to store the data if it is meaningful, to avoid using too much storage, I wanted to only save what I need.
    I did this:
    Code (Java):
    for(Thing t : list)
                    yaml.set("Thing List." + t.toString(), t.getData());
    The problem I'm having is that maybe the first time I want to save it, which would give me this bit of YAML:
    Code (YAML):
    Thing List:
     THINGA = 'Data 1'
      THINGB = 'Data 2'
    but then, the second time, when I won't want to re-save it, so with my boolean .shouldSave() I won't write the data, but because it already exists in the file, I won't be deleted, so I end up storing a bunch of data that I don't need to store, and I can't manage to delete it...
    I've searched in the Spigot Javadocs, but didn't manage to find anything to delete data from a YamlConfiguration...
    Thanks for helping!
  2. Usually if I want to delete something I just set it to "null"
    Code (Java):
    configVar.set("", null);
    • Like Like x 1
  3. Ok okay, thanks!