Minecraft and UUIDs

This post was written for users of my plugin GoldBank. If you're not from its BukkitDev page, you likely don't care and are free to stop reading at any point you desire.

As you may have heard by now, Minecraft will in the very near future support username changes. Since usernames are no longer static, Mojang has implemented a new system for uniquely identifying players: unique identifiers (who would've guessed it?), also known as UUIDs. A UUID is essentially a string consisting of 32 hex characters and four dashes.

This transition presents a problem for many plugin developers, including myself. A plugin of mine called GoldBank is particularly vulnerable, as almost all data stored by the plugin uses usernames (including banks data, bank inventories, wallet inventories, shop data, and shop logs). Subsequently, I now need to modify it to a) convert all existing data to use UUIDs, and b) modify the rest of the plugin to store and expect only UUIDs. The methods which allow me to do so were introduced in a relatively recent version of Bukkit (#3035), so ordinarily, such changes would break the plugin for servers running anything older. I don't want to do that, so I'm currently working to avoid such a scenario at all costs.

The first solution I came up with was to use Bukkit's native UUID methods if supported, and if not, fall back to Mojang's online API. However, that would mean the plugin would need to send a POST request every time someone created/modified/used a bank/wallet/shop. This would result in a significant performance impact when performing such actions. The alternative is to convert the data only if the current version of Craftbukkit/Spigot/whatever-you-will supports it. However, this would be significantly more difficult to code for, and would make the data unusable by older versions of GoldBank.

I'm going to make a decision within the next couple of days as to what I want to do. In the meantime, I'll start converting the plugin to use UUIDs, and include compatibility code later on. Once the update is ready, it'll be crucial that you update before Mojang enables name-changing support, as personal data may become dissociated from players who have changed their names.

Update #1: I've decided to use the fallback method. It's a lot easier to code, and will probably be much less messy. The way I have it now, it'll check when the plugin loads if the Bukkit/Spigot build supports UUIDs, and retrieve them accordingly.

Update #2: I pushed the new build to BukkitDev a few minutes ago as of 8 P.M. Sunday (April 13th). Hopefully, the moderators will approve it within 48 hours, and it will be available for public download.

Posted by Max Roncace on April 12, 2014

Log in or register to post a comment!

No comments to display!