Use length for UUID compat as contains is expensive

This commit is contained in:
Myles 2016-11-15 19:53:22 +00:00
parent 071b42c9e0
commit b15c93c416

View File

@ -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);