add trimmed uuid to player response

This commit is contained in:
Lee 2024-04-11 03:57:46 +01:00
parent 6f840654e9
commit 4f26110405
2 changed files with 17 additions and 0 deletions

@ -22,4 +22,15 @@ public class UUIDUtils {
} }
return UUID.fromString(builder.toString()); return UUID.fromString(builder.toString());
} }
/**
* Remove dashes from a UUID.
*
* @param dashed the UUID with dashes
* @return the UUID without dashes
*/
@NonNull
public static String removeDashes(@NonNull UUID dashed) {
return dashed.toString().replace("-", "");
}
} }

@ -17,6 +17,11 @@ public class Player {
*/ */
@Id private final UUID uniqueId; @Id private final UUID uniqueId;
/**
* The trimmed UUID of the player
*/
private final String trimmedUniqueId;
/** /**
* The username of the player * The username of the player
*/ */
@ -41,6 +46,7 @@ public class Player {
public Player(MojangProfile profile) { public Player(MojangProfile profile) {
this.uniqueId = UUIDUtils.addDashes(profile.getId()); this.uniqueId = UUIDUtils.addDashes(profile.getId());
this.trimmedUniqueId = UUIDUtils.removeDashes(this.uniqueId);
this.username = profile.getName(); this.username = profile.getName();
this.rawProperties = profile.getProperties(); this.rawProperties = profile.getProperties();