[Resource] A UUID Manager with caching

Discussion in 'Resources' started by Staartvin, May 10, 2014.

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

    Staartvin

    So it's been a while since Bukkit started implementing the changes necessary for getting itself ready for Minecraft 1.8 and the ability to change names. This is all fun and games, but it's kind of depressing for some of the developers here. You need to change all your plugins to use the new UUID system, which can be quite a frustrating job.

    A few weeks ago, I saw a resource from evilmidget38. It was a library to get the player name of a UUID and the other way around. That's quite handy! But it lacked a (good) manager. So today I'll show you a simple manager I made, that should get most jobs done involving UUIDs.

    The manager itself is on github (the repo of my public project Autorank). You can find it here.

    It uses both the NameFetcher and UUIDFetcher class of evilmidget38. Thank you very much for that, Evil!

    So you might ask why you would use mine over others: mine has a caching system! :)
    It caches all player names and their associated UUIDs so that whenever you need to get the UUID again, it will simple grab it from the cache memory. This reduces the restrain on the server because you don't have to constantly look them up. The default 'valid-cache' time is 12 hours, but you can change that if you want.

    Note:
    The NameFetcher and UUIDFetcher do 'internet-lookups'. It's advised to run the methods getPlayers(), getUUIDs(), getPlayerFromUUID() and getUUIDFromPlayer asynchronously. If you run them on the main thread, they will most certainly block the main thread, and we don't want that to happen!

    You can grab the NameFetcher and UUIDFetcher from here.

    If you have any questions or notes, feel free to comment!
     
    synquall and extended_clip like this.
Thread Status:
Not open for further replies.

Share This Page