diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java index 031a2fb..d65f7ec 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDFetcher.java @@ -70,7 +70,7 @@ public class UUIDFetcher implements Callable> { return connection; } - private static UUID getUUID(String id) { + public static UUID getUUID(String id) { return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); } diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java index 3658ee3..4faf5e8 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/util/UUIDTranslator.java @@ -26,6 +26,7 @@ public class UUIDTranslator { private final RedisBungee plugin; private BiMap uuidMap = Maps.synchronizedBiMap(HashBiMap.create()); public static final Pattern UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"); + public static final Pattern MOJANGIAN_UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{32}"); public UUID getTranslatedUuid(String player) { if (ProxyServer.getInstance().getPlayer(player) != null) @@ -39,6 +40,11 @@ public class UUIDTranslator { return UUID.fromString(player); } + if (MOJANGIAN_UUID_PATTERN.matcher(player).find()) { + // Reconstruct the UUID + return UUIDFetcher.getUUID(player); + } + if (!plugin.getProxy().getConfig().isOnlineMode()) { uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + player).getBytes(Charsets.UTF_8)); uuidMap.put(player, uuid);