cache the skin image
All checks were successful
deploy / deploy (push) Successful in 42s

This commit is contained in:
Lee 2024-04-08 06:36:35 +01:00
parent e90f409ce9
commit d3adb6815d
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package cc.fascinated.model.player;
import cc.fascinated.config.Config;
import cc.fascinated.util.PlayerUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.JsonObject;
import lombok.AllArgsConstructor;
@ -28,6 +29,11 @@ public class Skin {
*/
private final Model model;
/**
* The skin data of the skin
*/
private final byte[] skinData;
/**
* The part URLs of the skin
*/
@ -37,6 +43,8 @@ public class Skin {
public Skin(String url, Model model) {
this.url = url;
this.model = model;
this.skinData = PlayerUtils.getSkinData(url);
}
/**

View File

@ -46,7 +46,7 @@ public class PlayerUtils {
}
try {
BufferedImage image = ImageIO.read(new ByteArrayInputStream(PlayerUtils.getSkinData(skin.getUrl())));
BufferedImage image = ImageIO.read(new ByteArrayInputStream(skin.getSkinData()));
if (image == null) {
return null;
}