#1012: Always save as skull owner and not as internal data

This commit is contained in:
DerFrZocker 2022-02-13 20:52:46 +01:00 committed by md_5
parent de95135562
commit 6a54e5d374
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -5,7 +5,6 @@ import com.mojang.authlib.GameProfile;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import net.minecraft.nbt.GameProfileSerializer; import net.minecraft.nbt.GameProfileSerializer;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.level.block.entity.TileEntitySkull; import net.minecraft.world.level.block.entity.TileEntitySkull;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -79,13 +78,6 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
} }
} }
@Override
void serializeInternal(final Map<String, NBTBase> internalTags) {
if (profile != null) {
internalTags.put(SKULL_PROFILE.NBT, serializedProfile);
}
}
private void setProfile(GameProfile profile) { private void setProfile(GameProfile profile) {
this.profile = profile; this.profile = profile;
this.serializedProfile = (profile == null) ? null : GameProfileSerializer.writeGameProfile(new NBTTagCompound(), profile); this.serializedProfile = (profile == null) ? null : GameProfileSerializer.writeGameProfile(new NBTTagCompound(), profile);
@ -244,7 +236,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
@Override @Override
Builder<String, Object> serialize(Builder<String, Object> builder) { Builder<String, Object> serialize(Builder<String, Object> builder) {
super.serialize(builder); super.serialize(builder);
if (hasOwner()) { if (this.profile != null) {
return builder.put(SKULL_OWNER.BUKKIT, new CraftPlayerProfile(this.profile)); return builder.put(SKULL_OWNER.BUKKIT, new CraftPlayerProfile(this.profile));
} }
return builder; return builder;