Help with iterating through players

Discussion in 'Plugin Development' started by Yazan, Jan 4, 2014.

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


    Hello. I have a .yml file for every player that stores a players score in a minigame. How can I iterate through all these files and check who has the most points? This is my player creation method:

    **FileMgr is the class**

    public void createPFile(PlayerJoinEvent e)
            Player player = e.getPlayer();
            FileMgr.pfile = new File("plugins" + File.separator + "WarsMinigame" +File.separator + "PlayerData" +
            File.separator +  player.getName() + ".yml");
            playerfile = YamlConfiguration.loadConfiguration(pfile);
                try {
                    playerfile.set("Level", 1);
                    playerfile.set("Coins", 100);
                    System.out.println("Created PlayerFile '" + player.getName() + ".yml'");
                    } catch(Exception ee)
  2. Offline


    Yazan so for mine i checked if the player kills is greater than the highest kills then if it is i update the highest kills. you can do that with points too. just store the highest score somewhere.

    x= config.getInt("Score")
    y = data.getString("HighestScore")
    if x > y
    data.set("highestScore", x)

    you get the idea
Thread Status:
Not open for further replies.

Share This Page