Makin a Head Leaderboard plugin

Discussion in 'Spigot Plugin Development' started by Stellrow, Jul 27, 2018.

  1. So i want to make a Head Leaderboard plugin,my question is how can i get the top values of a player like,most kills,most money..?
     
  2. Well the displaying isn't really hard, is it? You just need to get the top N players (i.e. by sorting the data) and just display it.
     
  3. Yes but where do i get the data from is there like a bukkit event or something?
     
  4. Bukkit has no idea of money. For kills, you either have to track it yourself or possibly use statistics.
     
  5. Get all the offline and online players using
    Code (Text):

    Bukkit.getOfflinePlayers()
    Bukkit.getOnlinePlayers()
     
    Store them in a collection and get their Statistics. Use an external plugin like Vault to get their balance. Then you can sort however you please.
     
  6. Store the locations of the heads, then store the uuid and the value of all the players; sort the map by its values and then get the top ten using a for loop or however you may what to do so, you can then replace the skullOwner of the stored location-heads to the owner and possibly a sign or hologram near it. You can use entitydeathevent or playerdeathevent to get the kills value, use vaultapi to get money, and then you can track anything else using the same process :)