Configuration file won't create itself

Discussion in 'Plugin Development' started by xpaintall, Jul 7, 2021.

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

    xpaintall

    So basically I want my config.yml to create but it won't for some reason.
    Code:
    public void onEnable() {
    loadConfiguration();
    }
    
    public void loadConfiguration() {
            getConfig().options().copyDefaults(true);
            saveConfig();
        }
    That's basically what I've done to create my config file, but it doesn't want to create. Help
     
  2. Offline

    timtower Administrator Administrator Moderator

    @xpaintall Do you have something in the plugin jar then?
     
  3. Offline

    xpaintall

  4. Offline

    timtower Administrator Administrator Moderator

    Then what would it save? What defaults would it have?
     
  5. Offline

    xpaintall

    @timtower It wouldn't save anything for some reason.
     
  6. Offline

    timtower Administrator Administrator Moderator

    Because there is nothing to save if you have nothing defined.
     
  7. Offline

    xpaintall

    @timtower I tried to save this, but it didn't
    Code:
    f.getConfig().set("Guilds." + guildname + ".Level", 1);
    f.getConfig().set("Guilds." + guildname + ".GuildExp", 0);
    f.getConfig().set("Guilds." + guildname + ".Tag", "");
     
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    xpaintall

    @timtower sorry for the wait, yeah I forgot to call saveConfig();
     
Thread Status:
Not open for further replies.

Share This Page