diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/block/entity/SkullBlockEntity.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/block/entity/SkullBlockEntity.java index 33473c8b..daafb0a7 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/block/entity/SkullBlockEntity.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world/block/entity/SkullBlockEntity.java @@ -24,6 +24,7 @@ */ package de.bluecolored.bluemap.core.world.block.entity; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -31,6 +32,7 @@ import java.util.Map; import java.util.UUID; +@Getter public class SkullBlockEntity extends BlockEntity { private final @Nullable String noteBlockSound; private final @Nullable String extraType; @@ -47,18 +49,6 @@ protected SkullBlockEntity(Map data) { this.skullOwner = ownerData != null ? new SkullOwner(ownerData) : null; } - public @Nullable String getNoteBlockSound() { - return noteBlockSound; - } - - public @Nullable String getExtraType() { - return extraType; - } - - public SkullOwner getSkullOwner() { - return skullOwner; - } - @Override public String toString() { return "SkullBlockEntity{" + @@ -68,6 +58,7 @@ public String toString() { "} " + super.toString(); } + @Getter public static class SkullOwner { private final @Nullable UUID id; private final @Nullable String name; @@ -75,8 +66,14 @@ public static class SkullOwner { @SuppressWarnings("unchecked") private SkullOwner(Map data) { - int[] uuidInts = (int[]) data.get("Id"); - this.id = new UUID((long) uuidInts[0] << 32 | uuidInts[1], (long) uuidInts[2] << 32 | uuidInts[3]); + int @Nullable [] uuidInts = (int[]) data.get("Id"); + + if (uuidInts == null || uuidInts.length != 4) { + this.id = null; + } else { + this.id = new UUID((long) uuidInts[0] << 32 | uuidInts[1], (long) uuidInts[2] << 32 | uuidInts[3]); + } + this.name = (String) data.get("Name"); Map properties = (Map) data.getOrDefault("Properties", Map.of()); @@ -87,18 +84,6 @@ private SkullOwner(Map data) { } } - public UUID getId() { - return id; - } - - public String getName() { - return name; - } - - public List getTextures() { - return textures; - } - @Override public String toString() { return "SkullOwner{" + @@ -109,6 +94,7 @@ public String toString() { } } + @Getter public static class Texture { private final @Nullable String signature; private final String value; @@ -118,14 +104,6 @@ private Texture(Map data) { this.value = (String) data.getOrDefault("value", ""); } - public String getSignature() { - return signature; - } - - public String getValue() { - return value; - } - @Override public String toString() { return "Texture{" +