★ Founding developer program: Pro free for 90 days for the first 50 developers →

Guides · Engineering

Offline mode, proxies and UUIDs: what your Minecraft plugin has to handle

Offline-mode servers, BungeeCord and Velocity backends and Bedrock players all change what a UUID means. How to store player data so it survives all of them.

Updated · by Skilled · 5 min read

Most plugins are written and tested on one kind of server: a single Paper server in online mode, with the developer's own account. Then they get installed behind a proxy, on an offline-mode server, or on a network with Bedrock players, and the bug reports start: stats that reset after a name change, homes that belong to the wrong player, a lookup that freezes the server for a second.

Almost all of these come from the same place: assuming a UUID means the same thing everywhere. This guide covers what the UUID really is in each setup and how to write code that works in all of them.

Where the UUID comes from

Online mode. The server checks every login with Mojang. The UUID is the player's account UUID: the same on every server, and it never changes, even when the player changes their name.

Offline mode. Nobody checks the account. The server makes the UUID from the name:

UUID offline = UUID.nameUUIDFromBytes(
        ("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8));

Same name, same UUID, on every offline server. A different name, even with the same account, is a different UUID. And anyone can join with any name.

Behind a proxy. The backend servers run with online-mode=false in server.properties, because the proxy does the checking. With forwarding set up (ip_forward: true in BungeeCord plus bungeecord: true in spigot.yml, or Velocity's modern forwarding plus proxies.velocity in Paper's config/paper-global.yml), the proxy passes the real account UUID to the backend. Without it, the backend makes offline UUIDs, and every player gets a different UUID than on the rest of the network.

Bedrock players. With Geyser and Floodgate, Bedrock players join Java servers without a Java account. Floodgate gives them a UUID made from their Xbox account, and their name gets a prefix (a dot by default) so it can't collide with a Java name.

Rule 1: store data by UUID, never by name

In online mode and behind a correctly set up proxy, the UUID is stable and the name isn't. Store everything by UUID and keep the last known name next to it, only for display:

// On join: update the name we show, never the key
storage.updateName(player.getUniqueId(), player.getName());

On offline servers this also works: the UUID follows the name, so a name change is a new player there anyway. What you avoid is code that works on one kind of server and silently mixes up players on another.

Rule 2: don't read online mode as "cracked"

Bukkit.getOnlineMode() returns the server's own setting. On every backend behind a proxy it's false, even when the proxy checks every account. Don't use it to decide whether to trust UUIDs, show warnings, or turn features off. A backend that reports offline mode is, more often than not, a network server.

If you need to know whether a Spigot or Paper server is behind BungeeCord, the settings.bungeecord value in spigot.yml tells you. For anything that depends on accounts being real, let the server owner say so in your config instead of guessing.

Rule 3: never look up names on the main thread

Bukkit.getOfflinePlayer(String name) is deprecated for a reason: when the player isn't in the server's cache, it can make a blocking web request to Mojang to find the UUID. One slow answer from Mojang and the whole server waits for it.

Instead:

  • For a player who is online, use Bukkit.getPlayerExact(name).
  • For admin commands that take the name of an offline player, look the name up in your own storage, where you saved the last known name for each UUID.
  • On Paper, Bukkit.getOfflinePlayerIfCached(name) never makes a web request.

If you do need Mojang's API, call it off the main thread and cache the answer. The same reasoning as for databases applies: using a database without lagging the server.

Rule 4: accept names you didn't expect

A Java name is 3 to 16 letters, digits and underscores. Code that validates names with that pattern breaks on Bedrock players (.Steve) and on some offline servers. Validate input from commands loosely, match it against online players and your own storage, and never use a player name as a file name or a database key.

Rule 5: plan for servers that switch modes

Server owners do move from offline to online mode, or put an existing server behind a proxy. Every player's UUID changes at that moment, and every plugin that stores data by UUID loses it.

You can't fix that silently, but you can make it fixable. If your plugin keeps the last known name for each UUID, an admin command can move data from the offline UUID (computed from the name, as above) to the new one. Document it once in your wiki; it saves the same support conversation many times.

How to test it

You don't need several accounts:

  • Run a local server with online-mode=false and join with any name from a launcher that allows offline play, or with a bot. Change the name and check that your data behaves the way you expect.
  • Run a small network: Velocity or BungeeCord with two Paper backends, forwarding on. Check that a player has the same UUID on both backends and on the proxy.
  • Turn forwarding off on one backend and see what your plugin does with a player who suddenly has a different UUID there.

Knowing which setups your users run

Which of these matters most depends on who installs your plugin. With PluginAnalytics, the Servers page shows every server running your plugin by platform, Minecraft version, country and online mode, on the Free plan, with no code beyond starting the SDK. What's collected automatically

Read the online mode chart with Rule 2 in mind: it shows what each server reports, so backends behind a proxy count as offline. If you also ship a Velocity or BungeeCord version of your plugin, its installs show the networks directly. Analytics for Velocity and BungeeCord plugins

Players are counted the same way in every mode: each is a salted hash of whatever UUID the server gives them, different on every server, so nothing that identifies them leaves the server. For server owners

Checklist

  • Data keyed by UUID, name stored only for display.
  • No decisions based on getOnlineMode() alone.
  • No name-to-UUID lookups on the main thread.
  • Name validation that accepts Bedrock and offline names.
  • A documented way to move data when a server changes mode.
  • Tested on an offline server and on a small proxy network before release.
Skilled

Makes Minecraft plugins (including The Sift on SpigotMC) and PluginAnalytics, so other plugin developers can see how their plugins are found, installed and used.

More guides

Engineering

Analytics for Velocity and BungeeCord plugins

What you can measure in a Velocity or BungeeCord proxy plugin, why a proxy is not a server, and how to count networks, players, features and errors.

4 min read
Engineering

Using a database in a Minecraft plugin without lagging the server

Load and save player data from MySQL or SQLite off the main thread, with a connection pool, a cache, safe shutdown saves and errors you can see.

5 min read

See how your own plugin is found and used

Free for your first plugin or mod. One line of code.