This commit is contained in:
parent
3f7f1864a6
commit
1f45d26f53
@ -1,9 +1,9 @@
|
||||
package cc.fascinated.controller;
|
||||
|
||||
import cc.fascinated.service.player.PlayerService;
|
||||
import cc.fascinated.service.player.impl.Player;
|
||||
import cc.fascinated.service.player.impl.Skin;
|
||||
import cc.fascinated.service.player.impl.SkinPart;
|
||||
import cc.fascinated.service.PlayerService;
|
||||
import cc.fascinated.model.player.Player;
|
||||
import cc.fascinated.model.player.Skin;
|
||||
import cc.fascinated.model.player.SkinPart;
|
||||
import lombok.NonNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.CacheControl;
|
||||
@ -49,7 +49,7 @@ public class PlayerController {
|
||||
@RequestParam(required = false, defaultValue = "250") int size) {
|
||||
Player player = playerManagerService.getPlayer(id);
|
||||
byte[] headBytes = new byte[0];
|
||||
if (player != null) {
|
||||
if (player != null) { // The player exists
|
||||
Skin skin = player.getSkin();
|
||||
SkinPart skinPart = skin.getPart(part);
|
||||
if (skinPart != null) {
|
||||
@ -57,7 +57,7 @@ public class PlayerController {
|
||||
}
|
||||
}
|
||||
|
||||
if (headBytes == null) {
|
||||
if (headBytes == null) { // Fallback to the default head
|
||||
headBytes = defaultHead.getPartData(size);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cc.fascinated.exception;
|
||||
|
||||
import cc.fascinated.model.ErrorResponse;
|
||||
import cc.fascinated.model.response.ErrorResponse;
|
||||
import io.micrometer.common.lang.NonNull;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.service.player.impl;
|
||||
package cc.fascinated.model.player;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
@ -1,10 +1,11 @@
|
||||
package cc.fascinated.service.player.impl;
|
||||
package cc.fascinated.model.player;
|
||||
|
||||
import cc.fascinated.service.mojang.types.MojangProfile;
|
||||
import cc.fascinated.service.mojang.model.MojangProfile;
|
||||
import cc.fascinated.util.Tuple;
|
||||
import cc.fascinated.util.UUIDUtils;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@ -21,24 +22,26 @@ public class Player {
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The skin of the player
|
||||
* <p>
|
||||
* This will be null if the player does not have a skin.
|
||||
* </p>
|
||||
* The skin of the player, null if the
|
||||
* player does not have a skin
|
||||
*/
|
||||
private Skin skin;
|
||||
|
||||
/**
|
||||
* The cape of the player
|
||||
* <p>
|
||||
* This will be null if the player does not have a cape.
|
||||
* </p>
|
||||
* The cape of the player, null if the
|
||||
* player does not have a cape
|
||||
*/
|
||||
private Cape cape;
|
||||
|
||||
/**
|
||||
* The raw properties of the player
|
||||
*/
|
||||
private final List<MojangProfile.ProfileProperty> rawProperties;
|
||||
|
||||
public Player(MojangProfile profile) {
|
||||
this.uuid = UUID.fromString(UUIDUtils.addUUIDDashes(profile.getId()));
|
||||
this.name = profile.getName();
|
||||
this.rawProperties = profile.getProperties();
|
||||
|
||||
// Get the skin and cape
|
||||
Tuple<Skin, Cape> skinAndCape = profile.getSkinAndCape();
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.service.player.impl;
|
||||
package cc.fascinated.model.player;
|
||||
|
||||
import cc.fascinated.Main;
|
||||
import cc.fascinated.config.Config;
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.service.player.impl;
|
||||
package cc.fascinated.model.player;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.log4j.Log4j2;
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.model;
|
||||
package cc.fascinated.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.micrometer.common.lang.NonNull;
|
@ -1,9 +1,9 @@
|
||||
package cc.fascinated.service.player;
|
||||
package cc.fascinated.service;
|
||||
|
||||
import cc.fascinated.service.mojang.MojangAPIService;
|
||||
import cc.fascinated.service.mojang.types.MojangProfile;
|
||||
import cc.fascinated.service.mojang.types.MojangUsernameToUuid;
|
||||
import cc.fascinated.service.player.impl.Player;
|
||||
import cc.fascinated.service.mojang.model.MojangProfile;
|
||||
import cc.fascinated.service.mojang.model.MojangUsernameToUuid;
|
||||
import cc.fascinated.model.player.Player;
|
||||
import cc.fascinated.util.UUIDUtils;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.jodah.expiringmap.ExpirationPolicy;
|
@ -1,7 +1,7 @@
|
||||
package cc.fascinated.service.mojang;
|
||||
|
||||
import cc.fascinated.service.mojang.types.MojangProfile;
|
||||
import cc.fascinated.service.mojang.types.MojangUsernameToUuid;
|
||||
import cc.fascinated.service.mojang.model.MojangProfile;
|
||||
import cc.fascinated.service.mojang.model.MojangUsernameToUuid;
|
||||
import cc.fascinated.util.WebRequest;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cc.fascinated.service.mojang.types;
|
||||
package cc.fascinated.service.mojang.model;
|
||||
|
||||
import cc.fascinated.Main;
|
||||
import cc.fascinated.service.player.impl.Cape;
|
||||
import cc.fascinated.service.player.impl.Skin;
|
||||
import cc.fascinated.model.player.Cape;
|
||||
import cc.fascinated.model.player.Skin;
|
||||
import cc.fascinated.util.Tuple;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.AllArgsConstructor;
|
@ -1,4 +1,4 @@
|
||||
package cc.fascinated.service.mojang.types;
|
||||
package cc.fascinated.service.mojang.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
Loading…
Reference in New Issue
Block a user