3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Fixed 1.7 UUID, oops. Thanks @MineTheCube

Dieser Commit ist enthalten in:
Myles 2016-11-15 21:17:39 +00:00
Ursprung b15c93c416
Commit ff1554556e

Datei anzeigen

@ -114,9 +114,9 @@ public class BaseProtocol extends Protocol {
info.setState(State.PLAY); info.setState(State.PLAY);
// Save other info // Save other info
String stringUUID = wrapper.get(Type.STRING, 0); String stringUUID = wrapper.get(Type.STRING, 0);
if (stringUUID.length() == 28) { if (stringUUID.length() == 32) { // Trimmed UUIDs are 32 characters
// Trimmed // Trimmed
stringUUID = stringUUID.replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"); stringUUID = addDashes(stringUUID);
} }
UUID uuid = UUID.fromString(stringUUID); UUID uuid = UUID.fromString(stringUUID);
info.setUuid(uuid); info.setUuid(uuid);
@ -237,4 +237,13 @@ public class BaseProtocol extends Protocol {
} }
} }
} }
public static String addDashes(String trimmedUUID) {
StringBuffer idBuff = new StringBuffer(trimmedUUID);
idBuff.insert(20, '-');
idBuff.insert(16, '-');
idBuff.insert(12, '-');
idBuff.insert(8, '-');
return idBuff.toString();
}
} }