Prevent config.save(file); from overwriting old file

Discussion in 'Plugin Development' started by Numenorean95, Mar 6, 2012.

  1. Offline

    Numenorean95

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    name says it all, i have a nice detailed default configuration file generated on first run, but immediately afterwards when i use config.save(file); to save any value changes it overwrites everything in the file and puts in just the values. Does anyone know how to get around this? All i waant it to do is change the values in the old file.

    This post has been edited 1 time. It was last edited by Numenorean95 Mar 6, 2012.
  2. Offline

    zachoooo

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I dont really understand what you are trying to say. Using config.save(file) is supposed to override the old file. If you mean that your changes aren't saving, then make sure that before you save that you set values with config.set("path", value);
  3. Offline

    Numenorean95

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Ok, looking back im amazed at how tired i must have been. Either that or someone snuck alcohol into my tea. Ill try again: What i want to be able to do is save any changes from a modified Configuration instance in a way the only modifies the values in a conf file, rather than overwrites the entire thing. This is done in the hope that the comments i have added to the default file will not be overwritten when the save() method is used. Does that clear it up?
  4. Online

    ZachBora

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I also had that problem and got rid of bukkit's config system altogheter.
    I create file objects and save them.
  5. Offline

    Numenorean95

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Hmm, well i do like some of the features of the Current configuration classes, so i guess i will write my own saver. Ill put it up here if anyone wants it.

Share This Page