Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6949

Can no longer save lists of config sections to yaml files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Ubuntu, mac OS

    • CraftBukkit version 3445-Spigot-fb0dd5f-05a38da (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
    • Yes

      I use lists of config sections to save simple data files.

      This would previously serialize as a list of maps. As of 1.18.2 this does not serialize properly:

      list:
      - !!org.bukkit.configuration.MemoryConfiguration
        defaults: null

      Test plugin: https://github.com/NathanWolf/Bukkit-Unit-Tests/releases/tag/config-lists

      Code:

      YamlConfiguration newConfig = new YamlConfiguration();
      List<ConfigurationSection> configList = new ArrayList<>();
      MemoryConfiguration newSection = new MemoryConfiguration();
      newSection.set("something", "value");
      configList.add(newSection);
      newConfig.set("list", configList);
      try {
          File outputFile = new File(getDataFolder(), "data.yml");
          newConfig.save(outputFile);
          getLogger().info("Wrote to: " + outputFile.getAbsolutePath());
      } catch (IOException ex) {
          getLogger().severe("Could not save file: " + ex.getMessage());
      }

      This is going to cause a lot of data loss for my users with flatfile storage when they update.

      I have not narrowed down the specific change, though I see a few suspects. As far as I know things have been working fine since the "save comments" re-work, so I think it's a more recent change.

            Unassigned Unassigned
            NathanWolf Nathan Wolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: