Files
Backend/src/main/java/xyz/mcutils/backend/model/player/Player.java

62 lines
1.5 KiB
Java
Raw Normal View History

2024-04-10 07:43:38 +01:00
package cc.fascinated.model.player;
import cc.fascinated.common.Tuple;
import cc.fascinated.common.UUIDUtils;
import cc.fascinated.model.skin.Skin;
2024-04-13 17:40:28 +01:00
import cc.fascinated.model.token.MojangProfileToken;
2024-04-10 07:43:38 +01:00
import lombok.AllArgsConstructor;
import lombok.Getter;
2024-04-13 17:17:13 +01:00
import lombok.NoArgsConstructor;
2024-04-10 07:43:38 +01:00
import java.util.UUID;
2024-04-13 17:17:13 +01:00
@Getter @AllArgsConstructor @NoArgsConstructor
2024-04-10 07:43:38 +01:00
public class Player {
/**
* The UUID of the player
*/
2024-04-13 17:17:13 +01:00
private UUID uniqueId;
2024-04-10 07:43:38 +01:00
2024-04-11 03:57:46 +01:00
/**
* The trimmed UUID of the player
*/
2024-04-13 17:17:13 +01:00
private String trimmedUniqueId;
2024-04-11 03:57:46 +01:00
2024-04-10 07:43:38 +01:00
/**
* The username of the player
*/
2024-04-13 17:17:13 +01:00
private String username;
2024-04-10 07:43:38 +01:00
/**
* The skin of the player, null if the
* player does not have a skin
*/
private Skin skin;
/**
* The cape of the player, null if the
* player does not have a cape
*/
private Cape cape;
/**
* The raw properties of the player
*/
2024-04-13 17:40:03 +01:00
private MojangProfileToken.ProfileProperty[] rawProperties;
2024-04-13 17:40:03 +01:00
public Player(MojangProfileToken profile) {
2024-04-11 00:49:16 +01:00
this.uniqueId = UUIDUtils.addDashes(profile.getId());
2024-04-11 03:57:46 +01:00
this.trimmedUniqueId = UUIDUtils.removeDashes(this.uniqueId);
2024-04-10 07:43:38 +01:00
this.username = profile.getName();
this.rawProperties = profile.getProperties();
2024-04-10 07:43:38 +01:00
// Get the skin and cape
Tuple<Skin, Cape> skinAndCape = profile.getSkinAndCape();
if (skinAndCape != null) {
this.skin = skinAndCape.getLeft();
this.cape = skinAndCape.getRight();
}
}
}