Solved No config file generated!

Discussion in 'Plugin Development' started by Asgernohns, Mar 21, 2014.

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

    Asgernohns

    hello programmers!

    I've never tried this before... I got my plugin and im trying to generate the config.yml.
    But nothing appears in the plugins folder..

    onEnable:
    Code:java
    1. public void onEnable(){
    2.  
    3. if(!setupEconomy()){
    4. logger.severe("Disabled! You dont have a econonmy plugin or Vault installed!");
    5. Bukkit.getPluginManager().disablePlugin(plugin);
    6. }
    7.  
    8. FileConfiguration config = getConfig();
    9.  
    10. this.bountiesConfig = new File(this.getDataFolder(), "bounties.yml");
    11. this.bountysavesC = YamlConfiguration.loadConfiguration(bountiesConfig);
    12.  
    13. config.addDefault("Bounty_price", Integer.valueOf(50));
    14. config.addDefault("Global_bounty_messages", Boolean.valueOf(true));
    15. getConfig().options().copyDefaults(true);
    16. saveDefaultConfig();
    17.  
    18.  
    19. PluginDescriptionFile pdf = this.getDescription();
    20. this.logger.info(pdf.getName()+ " v"+pdf.getVersion()+" Has been enabled!");
    21. Bukkit.getPluginManager().registerEvents(this, this);
    22.  
    23.  
    24.  
    25.  
    26.  
    27. }
     
  2. Offline

    drtshock

    For your bountiesConfig file, you are never checking to see if it exists and creating it if it doesn't.

    For your config.yml, I suggest just using the saveDefaultConfig() call. That will copy whatever is in your jar into memory and onto the server's disk. You don't need to copy and add defaults with that if you don't want. Just write the defaults into the config that you save in the same place you put your plugin.yml.
     
    Asgernohns likes this.
  3. Offline

    Asgernohns

    drtshock i just never used that before. It did always just wrote that thing and it always worked
     
Thread Status:
Not open for further replies.

Share This Page