Skip to content

Instantly share code, notes, and snippets.

@vemacs
Created November 29, 2015 23:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vemacs/33bd4eb9378ba0e6a8a7 to your computer and use it in GitHub Desktop.
Save vemacs/33bd4eb9378ba0e6a8a7 to your computer and use it in GitHub Desktop.
@SuppressWarnings("deprecation")
private UUID getIdFromBukkit(String name) {
Bukkit.getLogger().warning("Using potentially blocking Bukkit UUID lookup for: " + name);
UUID uuid = Bukkit.getOfflinePlayer(name).getUniqueId();
// If the uuid matches the fake one from Bukkit, return it as fake
if (uuid.equals(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)))) {
return null;
} else {
return uuid;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment