Add optional column for players uuids (#1840)
This commit is contained in:
committed by
Gabriele C
parent
ae68667f5e
commit
254d4d75a2
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user