Player UUID

So the last time I played Minecraft (as I’ve mentioned before) was in January so I wasn’t around when player UUIDs were added so is someone able to tell me if the UUIDs follow the standards of being 32 chars + 4 dashes?

It appears to be so. In the Bukkit API, fetching a player’s UUID also returns a java.util.UUID object, if that’s helpful at all. Although if using Mojang’s API to fetch IDs, it doesn’t look like it includes dashes.

1 Like

It’s the standard Java UUID. You can write it without the dashes to save bandwidth.

1 Like

player.getUniqueId() is giving me an error in Eclipse and I can’t find it in the source. Was it removed?

Not that I’m aware of, assuming you’re using Bukkit and not Sponge’s API. The method is from the Entity super class which Player inherits.

Using Sponge. Do not care much for Bukkit at this time.

Guess that’s why; I was referring to the one that was part of Bukkit’s API in my initial post. It’s quite possible that Sponge’s API just doesn’t have that implemented yet.

Edit: After looking at Sponge’s API a bit, it looks like there’s an Identifiable interface, which would allow you to use the getUniqueId method, although I’m not sure if the Player object utilizes it yet or not.

Edit again: After running a search for Identifiable, it looks like it only exists in that class, so currently appears that no other classes use it.

Yeh I just found a post that basically says that it was in Player but accidentally removed. Surprisingly though it hasn’t been added again.

By the looks they wanted to re-arrange what implemented interfaces so they didn’t need to implement so many for specific classes. Assuming once the inheritance is setup roughly like they want, the Identifiable interface will be applied to the top-most applicable super class, for the sake of not needing to implement like 10 interfaces per class. If it’s somewhat like Bukkit at some point, it may be inherited in the Entity class, as all entities in Minecraft seem to have UUIDs, albeit a bit different than user IDs.

Entity-related dev is currently happening on the branch. Here’s the corresponding PR . Currently OfflinePlayer uses identifiable and Entity will use it in the future.

1 Like

UUID’s should have never been implemented, there a mess and require developers to convert there plugins/mods from getPlayer() to getPlayer().getUUID(). UUID’s were a mistake and I’m sure not many people hate there usernames.

Oh no! We have to chain one more method on the end! This is the end of the world!

DotDash just about nailed it… If you can’t handle appending .getUUID() to getPlayer(), you might want to re-evaluate things. I get that with Bukkit it was an inconvenience because everything had to be converted, but there’s nothing to convert here right now so there’s practically no reason to not include a way to definitively identify a player, or any game object for that matter.

1 Like

For Larger Plugins (Bukkit/Spigot) Like Essentials, Most Likely It Would Take A While.

Find & replace. Would take 5 minutes.


I’d think a plugin that’s well enough structured, especially when as complex as Essentials, would have some sort of class to help with that. Like a manager class to handle translating that stuff rather than having several spots with repetitive code. Also helps narrow down points of failure.

Yeah, it needed like 20min to change my plugin and write an methode to update the database from names to UUIDs. So this was a very easy and quick change.