From b15c93c416770a1b05bd349ece8f224ed38ec717 Mon Sep 17 00:00:00 2001 From: Myles Date: Tue, 15 Nov 2016 19:53:22 +0000 Subject: [PATCH] Use length for UUID compat as contains is expensive --- .../java/us/myles/ViaVersion/protocols/base/BaseProtocol.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java index 57948db10..b1162f445 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java @@ -114,7 +114,8 @@ public class BaseProtocol extends Protocol { info.setState(State.PLAY); // Save other info 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"); } UUID uuid = UUID.fromString(stringUUID);