1.12.2 Getting top players from another plugin?

Discussion in 'Spigot Plugin Development' started by Sean0402, Feb 15, 2020.

  1. Hey all, I was looking into the plugin by clip called EzPrestige.

    It has an API to get the current players prestige and I was wondering how do I go about getting the top 10?

    I would know how to do this if it was stored on in a file of some sort but as far as I’m aware I don’t see it saving players prestige’s in a file anywhere? Any ideas on how to do this with the API he’s got available?

    link to plugin;
    https://www.spigotmc.org/resources/ezprestige.1794/
     
  2. It seems that it uses permission system to store prestige
    Code (Java):
     
      public static Prestige getCurrentPrestige(Player p)
      {
        if ((prestigeList == null) || (prestigeList.isEmpty())) {
          return null;
        }
        Prestige playerPrestige = null;
        for (int i = prestigeList.size(); i > 0; i--)
        {
          Prestige pr = (Prestige)prestigeList.get(Integer.valueOf(i));
          if (pr == null) {
            return null;
          }
          if (p.hasPermission("ezprestige.prestige." + pr.getPrestige()))
          {
            playerPrestige = (Prestige)prestigeList.get(Integer.valueOf(i));
            break;
          }
        }
        return playerPrestige;
      }
     
  3. I understand that but how would I go about converting that into a list to be ordered? I've only ever worked with files to grab the top 10.

    I'm wondering because if I grab permissions from a player. Surely they have to be online? (I think?)

    So how would I go about making the top 10 work with offline players if it's not from a file?