This commit is contained in:
parent
c52f9332a2
commit
1542cff64e
@ -5,10 +5,16 @@ import cc.fascinated.player.impl.Player;
|
||||
import cc.fascinated.player.impl.Skin;
|
||||
import cc.fascinated.player.impl.SkinPart;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/")
|
||||
public class PlayerController {
|
||||
@ -35,9 +41,11 @@ public class PlayerController {
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Skin skin = player.getSkin();
|
||||
SkinPart head = skin.getHead();
|
||||
return ResponseEntity.ok()
|
||||
.cacheControl(CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic())
|
||||
.contentType(MediaType.IMAGE_PNG)
|
||||
.body(head.getPartData());
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ public class SkinPart {
|
||||
if (image == null) {
|
||||
return null;
|
||||
}
|
||||
// Get the part of the image (e.g. the head)
|
||||
BufferedImage partImage = image.getSubimage(this.x, this.y, this.width, this.height);
|
||||
|
||||
// Scale the image
|
||||
|
@ -5,7 +5,7 @@ server:
|
||||
whitelabel:
|
||||
enabled: false
|
||||
|
||||
public-url: http://localhost
|
||||
public-url: http://localhost:80
|
||||
|
||||
mojang:
|
||||
session-server: https://sessionserver.mojang.com
|
||||
|
Loading…
x
Reference in New Issue
Block a user