Yaml Files Error

Discussion in 'Plugin Development' started by cimbraien, Feb 24, 2015.

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

    cimbraien

    So I'm making a plugin that functionality is to organize a guild, I use 2 yaml files to store the data. It seems to work until I reload the plugin. The fileconfiguration seems to be resetted to the default yaml files.

    I need someone to help me find the problem of my Code :)
     
  2. Offline

    Totom3

    Most of the time this happens when you forget to save the file in onDisable(). And it seems to be the case with your code. Also, saving the config files each time a guild is created/disbanded is unnecessary, and will lag the whole server.
     
  3. Offline

    cimbraien

    But what if I change the yaml manually then reload it? Will the changes be removed?

    Like if I delete my yaml files, then reload the plugin, it will generate the exact same files like before I deleted it.
     
    Last edited: Feb 24, 2015
  4. Offline

    guitargun

    if you have the save method in the ondisable it will give an error. you can have a try can catch and in the catch recreating the file etc. then save it.
     
  5. Offline

    Totom3

    @guitargun ...no...?

    @cimbraien If you manually change the file while it is loaded, it will have no effect on the loaded data, and next time you save to the disk, it will be overridden. If you want the manual changes to take place, you'll have to unload the current data, and then load it again (without saving).
     
Thread Status:
Not open for further replies.

Share This Page