Files getting reseted

Discussion in 'Plugin Development' started by nuno1212sss, Mar 5, 2014.

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

    nuno1212sss

    At my plugin I use more than 1 file and the 2nd file, does not work properly, here's my code
    Code:
        FileConfiguration config;
        File cfile;
        FileConfiguration ranks;
        File rFile;
     
        public void setup(Plugin p) {
            config = p.getConfig();
            config.options().copyDefaults(true);
            cfile = new File(p.getDataFolder(), "config.yml");           
            if (!p.getDataFolder().exists()) {
                p.getDataFolder().mkdir();
        }
            rFile = new File(p.getDataFolder(), "ranks.yml");
            ranks.options().copyDefaults(true);
            if(!rFile.exists()){
                try {
                    rFile.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
    The rFile is created with nothing on it... here ar my save and reload methods
    Code:
        public void saveRanks(){
            try{
                ranks.save(rFile);
            }catch(IOException e){
                ConsoleSender.Severe("Não foi possivel Guardar o ficheiro Ranks.yml");
            }
        }
    Code:
        public void reloadRanks(){
            ranks = YamlConfiguration.loadConfiguration(rFile);
            Ranks.loadConfig(YamlConfiguration.loadConfiguration(rFile));
        }
     
Thread Status:
Not open for further replies.

Share This Page