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

Use length for UUID compat as contains is expensive

Dieser Commit ist enthalten in:
Myles 2016-11-15 19:53:22 +00:00
Ursprung 071b42c9e0
Commit b15c93c416

Datei anzeigen

@ -114,7 +114,8 @@ 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.contains("-")) { if (stringUUID.length() == 28) {
// Trimmed
stringUUID = stringUUID.replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"); stringUUID = stringUUID.replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5");
} }
UUID uuid = UUID.fromString(stringUUID); UUID uuid = UUID.fromString(stringUUID);