package yushijinhun.authlibagent.util;

import java.util.UUID;

public final class UUIDUtils {

	public static String unsign(UUID uuid) {
		return uuid.toString().replace("-", "");
	}

	public static String unsign(String uuid) {
		return uuid.replace("-", "");
	}

	public static UUID toUUID(String uuid) {
		if (uuid.length() == 36) {
			return UUID.fromString(uuid);
		} else {
			return UUID.fromString(uuid.substring(0, 8) + "-" + uuid.substring(8, 12) + "-" + uuid.substring(12, 16) + "-" + uuid.substring(16, 20) + "-" + uuid.substring(20, 32));
		}
	}

	private UUIDUtils() {
	}

}

@@ -306,10 +306,14 @@
 %7B%0A%09%09
-if
+switch
  (uu
@@ -327,18 +327,25 @@
 th()
- == 36) %7B%0A
+) %7B%0A%09%09%09case 36:%0A%09
 %09%09%09r
@@ -377,19 +377,22 @@
 d);%0A
+%0A
 %09%09
-%7D else %7B%0A
+%09case 32:%0A%09
 %09%09%09r
@@ -562,13 +562,99 @@
 2));
+%0A%0A%09%09%09default:%0A%09%09%09%09throw new IllegalArgumentException(%22Invalid UUID string: %22 + uuid);
 %0A%09%09%7D%0A
+%0A
 %09%7D%0A%0A

add uuid length check in UUIDUtils.fromString