Checking if config.yml exists and generating one if it doesn't

Discussion in 'Plugin Development' started by Dysko, Oct 14, 2014.

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

    Dysko

    As the title says, I want to know how to generate a new config file if one already isn't there.
     
  2. Offline

    fireblast709

    Dysko saveDefaultConfig()?
     
  3. Offline

    Dysko

    fireblast709 I want to check if the config.yml file is already there as I am storing info in it. If it isn't there, I want to save the default config.
     
  4. Offline

    techboy291

  5. Offline

    TheCodingCat

    If you are still stuck do this
    Code:java
    1. public void onEnable() {
    2. File file = new File(this.getDataFolder(),"config.yml");
    3. if (!file.exists) {
    4. // generation
    5. }
    6. }
     
  6. Offline

    mythbusterma

    TheCodingCat

    No, if you are stuck you use the built in saveDefaultConfig(), it works just fine.
     
  7. Offline

    sharkdude812

    u can do if(config do u exist?) {
    yes. okay im fine.
    } wait u dont exist? {
    make the config pls.
    }
     
Thread Status:
Not open for further replies.

Share This Page