Add optional column for players uuids (#1840)

This commit is contained in:
Alexandre Vanhecke
2019-08-06 15:13:13 +02:00
committed by Gabriele C
parent ae68667f5e
commit 254d4d75a2
11 changed files with 86 additions and 3 deletions
@@ -0,0 +1,27 @@
package fr.xephi.authme.util;
import java.util.UUID;
/**
* Utility class for various operations on UUID.
*/
public final class UuidUtils {
// Utility class
private UuidUtils() {
}
/**
* Returns whether the given string as an UUID or null
*
* @param string the uuid to parse
* @return parsed UUID if succeed or null
*/
public static UUID parseUuidSafely(String string) {
try {
return UUID.fromString(string);
} catch (IllegalArgumentException | NullPointerException ex) {
return null;
}
}
}