Add profile properties to Player

This commit is contained in:
Braydon 2024-04-11 02:20:18 -04:00
parent 160fed45e8
commit 16a42d1af3
3 changed files with 14 additions and 7 deletions

@ -24,6 +24,7 @@
package me.braydon.mc.model;
import lombok.*;
import me.braydon.mc.model.token.MojangProfileToken;
import org.springframework.data.annotation.Id;
import java.util.UUID;
@ -33,9 +34,7 @@ import java.util.UUID;
*
* @author Braydon
*/
@AllArgsConstructor @Getter
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@ToString
@AllArgsConstructor @Getter @EqualsAndHashCode(onlyExplicitlyIncluded = true) @ToString
public class Player {
/**
* The unique id of this player.
@ -57,6 +56,11 @@ public class Player {
*/
private final Cape cape;
/**
* The raw profile properties of this player.
*/
@NonNull private final MojangProfileToken.ProfileProperty[] properties;
/**
* The profile actions this player has, null if none.
*/

@ -31,6 +31,7 @@ import me.braydon.mc.model.Cape;
import me.braydon.mc.model.Player;
import me.braydon.mc.model.ProfileAction;
import me.braydon.mc.model.Skin;
import me.braydon.mc.model.token.MojangProfileToken;
import org.springframework.data.redis.core.RedisHash;
import java.io.Serializable;
@ -51,9 +52,10 @@ public final class CachedPlayer extends Player implements Serializable {
*/
private long cached;
public CachedPlayer(@NonNull UUID uniqueId, @NonNull String username,
@NonNull Skin skin, Cape cape, ProfileAction[] profileActions, long cached) {
super(uniqueId, username, skin, cape, profileActions);
public CachedPlayer(@NonNull UUID uniqueId, @NonNull String username, @NonNull Skin skin, Cape cape,
@NonNull MojangProfileToken.ProfileProperty[] properties, ProfileAction[] profileActions,
long cached) {
super(uniqueId, username, skin, cape, properties, profileActions);
this.cached = cached;
}
}

@ -23,6 +23,7 @@
*/
package me.braydon.mc.model.token;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.gson.JsonObject;
import lombok.*;
import me.braydon.mc.config.AppConfig;
@ -123,7 +124,7 @@ public final class MojangProfileToken {
*
* @return the decoded value
*/
@NonNull
@NonNull @JsonIgnore
public String getDecodedValue() {
return new String(Base64.getDecoder().decode(value));
}