Custom yml Empty

Discussion in 'Plugin Development' started by user_91277742, Jun 27, 2018.

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

    user_91277742

    Hello there!
    So I have a problem and by the moment i cant find the issue (It's possible ,that the error will be a stupid thing).
    Its bassicaly , When i try to load a custom yml , put by default x values inside, but when the plugin is loaded, the custom yml is empty.
    Code:
        public void onEnable() {
            instance = this;
            events = new Eventos(this,events);
            cmds = new Comandos(this,events);
            registrarEventos();
            registrarComandos();
            cargarConfiguracion();
            if(!(getDataFolder().exists())){
                getDataFolder().mkdir();
                fruitConfiguration.addDefault("Potatoe", 0);
                fruitConfiguration.addDefault("Apple", 0);
                fruitConfiguration.addDefault("Banana", 0);
                fruitConfiguration.addDefault("Kiwi", 0);
            }
            try {
                fruitConfiguration.save(fruitFile);
                fruitConfiguration.load(fruitFile);
            } catch (IOException | InvalidConfigurationException e) {
                e.printStackTrace();
            }
        }
    
     
  2. You can use my custom YAML util. here
    Usage:
    Code:
    ConfigFile file = new ConfigFile("config");
    file.load();
    //new ConfigFile("config") -> is the file inside the jar.
     
Thread Status:
Not open for further replies.

Share This Page