Save defaults on first execution of the plugin

Discussion in 'Plugin Development' started by Webster56, Jul 12, 2013.

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

    Webster56

    Hello world !

    I'd like to 'extract' the config file contained in my jar at the first execution of my plugin.

    So I had the idea to put the saveDefaultConfig() in the onEnable(), but of course I want the users of my plugin to be able to modify it, and load the modification.

    Actually the thing would be to do the saveDefault(), if the file isn't extracted yet, anybody knows how could I check if it's extracted ?
     
  2. Offline

    Sessional

    Webster56
    Code:
     
     File file = new File(pluginDataDirectory, "config.yml");
    if (!file.exists())
    {
        saveDefaultConfig()
    }
    
     
  3. Offline

    Webster56

Thread Status:
Not open for further replies.

Share This Page