Going line by line through a config file?

Discussion in 'Plugin Development' started by skipperguy12, May 14, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    skipperguy12

    Hello! I just was playing around with an auto updater for one of my plugins, and I just realized that I want to update the config along with it. This is easy, but the problem is, what if I want to merge the two configs? I want to keep every setting the server owner has already altered, and just add mine too it? I am using a config.yml in my resources folder, so I DO have a local copy on my project, which is how I generate the config.yml, I simply copy it.

    Any ideas? I need to look line by line through local config and compare it to the same line of the config.yml of the server owner.

    Is there a way to do this with getResource perhaps?
     
  2. Offline

    Technius

    Ah, yes. I do this quite frequently by hand, but I don't know about YAML. I basically just have a bunch of println statements printing out the config line by line. It prints out the values of the stored variables, and not hardcoded values.
     
  3. Offline

    NoLiver92

    with the yml file you have to scan for the yml keys. once you have them all scan through them and get the data. do the same for the new config then compare them. copy the new config accross and then put back the settings the old plugin had in the new config.

    I hope this helps. i can give some code tonight but im away from home at the moment.
     
Thread Status:
Not open for further replies.

Share This Page