UUID Usage Question

Discussion in 'Plugin Development' started by Waffletastic, Apr 9, 2014.

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

    Waffletastic

    So I have the need to show players' names on a leaderboard. Since nobody can read a UUID, I was wondering what the best way is to store UUIDs and then convert them to a name whenever I want to display the leaderboard. Should I store a players name as well as their UUID to retrieve, or use the getOfflinePlayer() method or is there something else?
     
  2. Offline

    zDylann

    I would store the UUID's converted to strings in a config with a corresponding integer/sting to represent there score on the leaderboard. Then when you need to create the leaderboard grab the UUID and convert it back. If you are using the newest Bukkit builds you should have access to the methods to get a username from a UUID.
     
  3. Offline

    Waffletastic

    Already setup with sql.


    What method? That's the question here. getOfflinePlayer(UUID) is supposedly inefficient.
     
  4. Offline

    zDylann

  5. Offline

    blablubbabc

    Have some table which stores the "last known player name" for each uuid and updates when a player joins the server. That way you can still display playernames in your leaderboard for players which are not online, and without having to query some external service like mojang's.
    The name's might no longer be the players real, current name if the player changed his name and didn't yet connect to the server since then, but I guess that isn't that big of a problem for the simple informational purposes of a leaderboard.
     
  6. Offline

    amhokies

    This is what I've done for my protection plugin.
     
  7. Offline

    Alshain01

    Based on comments from EvilSeph I believe there will be a getLastKnownPlayerName() or equivalent in coming versions, so you won't have to store it anymore.
     
Thread Status:
Not open for further replies.

Share This Page