Solved Top 10 map... (ASkyblock)

Discussion in 'Spigot Plugin Development' started by LucKYsHoTSzZz, May 29, 2018.

Thread Status:
Not open for further replies.
  1. Code (Text):
                Map<UUID, Long> topTen = new HashMap<UUID, Long>(com.wasteofplastic.askyblock.ASkyBlockAPI.getInstance().getLongTopTen());
                int j = 1;
                  for (Map.Entry<UUID, Long> m : topTen.entrySet())
                  {
                    UUID playerUUID = (UUID)m.getKey();
                    player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&3" + j + "ยป " + Bukkit.getPlayer(UUID.fromString(playerUUID.toString())).getName() + " :&b " + topTen.get(playerUUID)));
               
                    if (j++ == 10) {
                      break;
                    }
                  }
                player.openInventory(topTenInv);
            }
    Assuming I use a map right (??right?? which sorts with the keys ??right??). Do I need to actually loop it on the value?
    Because my outcome is this: http://prntscr.com/jo91je

    Or should I make another Map but flips the params to sort it on island level?
     
    #1 LucKYsHoTSzZz, May 29, 2018
    Last edited: May 29, 2018
  2. Add all the strings to a arraylist instead of sending.
    And then use
    Collections.reverse(THE LIST);
    and then send the messages.

    or yer add a method to reverse the hashmap.
     
Thread Status:
Not open for further replies.