mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-13 00:18:00 +00:00
Support Mojangian UUIDs
This commit is contained in:
parent
730b77f227
commit
0136699b40
@ -70,7 +70,7 @@ public class UUIDFetcher implements Callable<Map<String, UUID>> {
|
|||||||
return connection;
|
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));
|
return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ public class UUIDTranslator {
|
|||||||
private final RedisBungee plugin;
|
private final RedisBungee plugin;
|
||||||
private BiMap<String, UUID> uuidMap = Maps.synchronizedBiMap(HashBiMap.<String, UUID>create());
|
private BiMap<String, UUID> uuidMap = Maps.synchronizedBiMap(HashBiMap.<String, UUID>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 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) {
|
public UUID getTranslatedUuid(String player) {
|
||||||
if (ProxyServer.getInstance().getPlayer(player) != null)
|
if (ProxyServer.getInstance().getPlayer(player) != null)
|
||||||
@ -39,6 +40,11 @@ public class UUIDTranslator {
|
|||||||
return UUID.fromString(player);
|
return UUID.fromString(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MOJANGIAN_UUID_PATTERN.matcher(player).find()) {
|
||||||
|
// Reconstruct the UUID
|
||||||
|
return UUIDFetcher.getUUID(player);
|
||||||
|
}
|
||||||
|
|
||||||
if (!plugin.getProxy().getConfig().isOnlineMode()) {
|
if (!plugin.getProxy().getConfig().isOnlineMode()) {
|
||||||
uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + player).getBytes(Charsets.UTF_8));
|
uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + player).getBytes(Charsets.UTF_8));
|
||||||
uuidMap.put(player, uuid);
|
uuidMap.put(player, uuid);
|
||||||
|
Loading…
Reference in New Issue
Block a user