add size limit to player images
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Has been cancelled

This commit is contained in:
Lee 2024-04-11 07:14:13 +01:00
parent bfbaf34b24
commit 977a1dcbc4
2 changed files with 6 additions and 2 deletions

@ -124,6 +124,10 @@ public class PlayerService {
* @return the skin part * @return the skin part
*/ */
public CachedPlayerSkinPart getSkinPart(Player player, Skin.Parts part, boolean renderOverlay, int size) { public CachedPlayerSkinPart getSkinPart(Player player, Skin.Parts part, boolean renderOverlay, int size) {
if (size > 1024) {
log.info("Size {} is too large, setting to 1024", size);
size = 1024;
}
log.info("Getting skin part {} for player: {}", part.getName(), player.getUniqueId()); log.info("Getting skin part {} for player: {}", part.getName(), player.getUniqueId());
String key = "%s-%s-%s".formatted(player.getUniqueId(), part.getName(), size); String key = "%s-%s-%s".formatted(player.getUniqueId(), part.getName(), size);
Optional<CachedPlayerSkinPart> cache = playerSkinPartCacheRepository.findById(key); Optional<CachedPlayerSkinPart> cache = playerSkinPartCacheRepository.findById(key);

@ -50,8 +50,8 @@ public class IsometricHeadRenderer extends SkinRenderer {
x = xOffset; x = xOffset;
y = -0.5; y = -0.5;
z = zOffset; z = zOffset;
// The head is offset by 1 pixel for whatever reason // The head is offset by 2 pixels for whatever reason
drawPart(graphics, headTop, HEAD_TRANSFORM, y - z, x + z, headTop.getWidth(), headTop.getHeight() + 1); drawPart(graphics, headTop, HEAD_TRANSFORM, y - z, x + z, headTop.getWidth(), headTop.getHeight() + 2);
// Draw the front of the head // Draw the front of the head
x = xOffset + 8 * scale; x = xOffset + 8 * scale;