Create a yml for every Player

Discussion in 'Plugin Development' started by Skrarity, Dec 26, 2015.

Thread Status:
Not open for further replies.
  1. So i am VERY new to Configs and pretty new to java well. So how i'd do it? I dont really now i now how to make a Config YML (Barely) but yeah i did the method "createConfigFor" and i want to do it in the JoinListener later
    but than i dont now how to get acces to the Config some method like "getMethodFrom(Player p)" but I dont really now how i would do this method.
    Well i know silly questions and MAYBE you can just find something which explains this, and yeah the Players Config should have the name of the UUID (Maybe you can see from Code) because i want to save stats and later add Kills , deaths , and elo but yeah thanks for your help and SRY for that kind of bad english...

    in my main class (I tried a Get thing but i think it wont work):
    Code:
        
    private FileConfiguration pstat;
    public void createConfigFor(Player p) {
            String idname = p.getUniqueId().toString();
            pstat = YamlConfiguration.loadConfiguration(new File(this.getDataFolder(), idname+".yml"));
            pstat.options().copyDefaults(true);
            pstat.addDefault(idname+".stats.kills","0");
            pstat.addDefault(idname+".stats.deaths","0");
            pstat.addDefault(idname+".stats.elo","2250");
          
        }
      
        public FileConfiguration getConfigFrom(Player p) {
            return pstat;
          
        }
     
    Last edited: Dec 26, 2015
  2. Offline

    Zombie_Striker

    mine-care likes this.
  3. Offline

    teej107

    mine-care likes this.
  4. Offline

    mug561

    May i ask why You want a new config for each player rather than one config with ALL players and data?
     
    Zombie_Striker likes this.
  5. Offline

    teej107

    There are times when you don't need all the players data at once.
     
Thread Status:
Not open for further replies.

Share This Page