Top 5 custom currency ?

Discussion in 'Plugin Development' started by __Sour, Mar 15, 2015.

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

    __Sour

    I have a custom currency in my core plugin. The storage of all of the players stats are currently in a yaml file, and planning to add it into a mysql table when a player joins where I get to that part of the plugin, but for right now I was wondering how I could loop through all the player files and the paths 'money' and get the top 5 balance, and don't know how to go about this
     
  2. Offline

    teej107

  3. Offline

    mythbusterma

    @__Sour

    I would add all the entries to a TreeMap, and store them there. When I need the top five, I either peek or poll.
     
  4. Offline

    __Sour

    @teej107
    This is what I have got so far, I was thinking to loop through all the files and the 'money' value in the folder and go for their, does this look about right so far?
    Code:
        public void getTop() {
            File file = new File(plugin.getDataFolder() + File.separator + "Users");
            FileConfiguration config = new YamlConfiguration();
            if (!file.exists())
                file.mkdirs();
            for (File users : file.listFiles()) {
               
            }
        }
     
Thread Status:
Not open for further replies.

Share This Page