Mojang response tokens

This commit is contained in:
Braydon 2024-04-06 14:44:08 -04:00
parent e0b12800f4
commit d11ea767d9
2 changed files with 80 additions and 0 deletions

@ -0,0 +1,63 @@
package me.braydon.mc.model.token;
import lombok.*;
import me.braydon.mc.model.ModerationAction;
/**
* A token representing a Mojang user profile.
*
* @author Braydon
* @see <a href="https://wiki.vg/Mojang_API#UUID_to_Profile_and_Skin.2FCape">Mojang API</a>
*/
@NoArgsConstructor @Setter @Getter @EqualsAndHashCode(onlyExplicitlyIncluded = true) @ToString
public final class MojangProfileToken {
/**
* The id of the profile.
*/
@EqualsAndHashCode.Include @NonNull private String id;
/**
* The name of the profile.
*/
@NonNull private String name;
/**
* The properties of the profile.
*/
@NonNull private ProfileProperty[] properties;
/**
* The actions this profile has.
*/
@NonNull private ModerationAction[] profileActions;
/**
* A property of a Mojang profile.
*/
@NoArgsConstructor @Setter @Getter @EqualsAndHashCode(onlyExplicitlyIncluded = true) @ToString
public static class ProfileProperty {
/**
* The name of this property.
*/
@EqualsAndHashCode.Include @NonNull private String name;
/**
* The base64 value of this property.
*/
@NonNull private String value;
/**
* The base64 signature of this property.
*/
private String signature;
/**
* Is this property signed?
*
* @return whether this property has a signature
*/
public boolean isSigned() {
return signature != null;
}
}
}

@ -0,0 +1,17 @@
package me.braydon.mc.model.token;
import lombok.*;
/**
* A token representing a Mojang username to UUID response.
*
* @author Braydon
* @see <a href="https://wiki.vg/Mojang_API#Username_to_UUID">Mojang API</a>
*/
@NoArgsConstructor @Setter @Getter @ToString
public final class MojangUsernameToUUIDToken {
/**
* The id of the username.
*/
private String id;
}