Top 5 custom currency ?

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

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


    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


  3. Offline



    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


    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?
        public void getTop() {
            File file = new File(plugin.getDataFolder() + File.separator + "Users");
            FileConfiguration config = new YamlConfiguration();
            if (!file.exists())
            for (File users : file.listFiles()) {
Thread Status:
Not open for further replies.

Share This Page