Store player data as YAML

Discussion in 'Plugin Development' started by soshimee, Jan 15, 2021.

  1. Offline

    soshimee

    How do I do this? I've searched for a while, but couldn't find any solutions. Storing it to plain config.yml looks dirty.

    Edit: Also, I'm using
    Code:
    File playerDataFile = new File(Main.getInstance().getDataFolder(), "playerdata.yml");
    FileConfiguration playerData = YamlConfiguration.loadConfiguration(playerDataFile);
    
    right now, but it doesn't seem to be saving to disk. (At least in the correct plugin directory).

    Anyone? Please?
     
    Last edited: Jan 16, 2021
  2. Offline

    CraftCreeper6

    @soshimee
    You need to use fileConfig#save(file) to save the file.
     
  3. Offline

    ForbiddenSoul

    That is exactly it, creating a file in program memory does not mean it has been created on your HDD/SSD. You need to call a save/ write function to actually make that happen.
     

Share This Page