Solved saveDefaultConfig() not saving config

Discussion in 'Plugin Development' started by SoThatsIt, May 25, 2013.

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

    SoThatsIt

    hi, i use saveDefaultConfig() in my onEnable() method but it does not save a version of my config, i dont even get a moreminecarts folder. I tried logging a message in my onEnable method as well and it did not work but interestingly it registered my event listener. Heres my onEnable()
    Code:
    @Override
        public void onEnable(){
            this.saveDefaultConfig();
            loadConfig();
            this.getServer().getPluginManager().registerEvents(new MoreMinecartsEventListener(this), this);
        }
    and my plugin.yml if that helps
    Code:
    name: MoreMinecarts
    main: me.sothatsit.moreminecarts.MoreMinecarts
    version: 0.1
    loadConfig() is a method that i have created that just gets all the values from my config

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  2. Offline

    felixfritz

    Make sure to copy the default options.
    PHP:
    this.getConfig().options().copyDefaults(true);
     
  3. Offline

    Sagacious_Zed Bukkit Docs

    SoThatsIt does a config exist for saveDefaultConfig to work?
     
  4. Offline

    SoThatsIt

    thnaks for the suggestion but it did not work :p, it isnt even creating the config at all, not even the data folder
     
  5. Offline

    Minnymin3

    Make a config.yml file in the same place as your plugin.yml and then do saveDefaultConfig(); You dont need to add all the values. Add all of the things you would add with your loadConfig method into the config.yml
     
  6. Offline

    SoThatsIt

    i have a config.yml in the same place as my plugin.yml it just isnt copying over.
     
  7. Offline

    Minnymin3

    Thats really weird... Just tested it and it works fine for me... Are you using a dev build of Bukkit it might be a Bukkit problem.
     
  8. Offline

    SoThatsIt

    ill test it with the newest build now :)

    i downloaded the recommended bukkit and craftbukkit builds, recompiled and loaded. still didnt work, even checked that the config.yml was inside the jar file

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  9. Offline

    Minnymin3

    weird... Ive got no idea but that could be because its 1:30 where I am...
     
  10. Offline

    SoThatsIt

    I am starting to think it is a problem with my onEnable() as using this.getLogger().info("TEST"); is not logging to terminal. Although, my event listener still gets registered.
     
  11. Offline

    Sagacious_Zed Bukkit Docs

    SoThatsIt If your plugin is not enabled, bukkit "should not" be registering your listeners.
     
  12. Offline

    SoThatsIt

    Then can you explain to me why it doesnt log the message? and why it doesnt create the config?

    I fixed it! turns out it wasnt a problem at all with my code but with my plugins folder, even when i deleted the plugin it still loaded... so i just deleted my plugins folder and then re-made it.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
Thread Status:
Not open for further replies.

Share This Page