2021-06-14 10:37:14 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 1 Jul 2020 03:12:06 -0400
|
|
|
|
Subject: [PATCH] Clean up duplicated GameProfile Properties
|
|
|
|
|
|
|
|
We had a bug where we accidently cloned properties resulting in skulls
|
|
|
|
growing to large sizes and preventing login.
|
|
|
|
|
|
|
|
This now automatically cleans up the extra properties.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
2021-11-24 16:07:19 +01:00
|
|
|
index b77b806b28dfada3e84e25d868aa8a8f8556f5af..97c5e6c70cd9f96bc229557a425fbffbf489910e 100644
|
2021-06-14 10:37:14 +02:00
|
|
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
|
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
|
|
@@ -93,7 +93,8 @@ public final class NbtUtils {
|
|
|
|
for(String string2 : compoundTag.getAllKeys()) {
|
|
|
|
ListTag listTag = compoundTag.getList(string2, 10);
|
|
|
|
|
|
|
|
- for(int i = 0; i < listTag.size(); ++i) {
|
|
|
|
+ if (listTag.size() == 0) continue; // Paper - remove duplicate properties
|
|
|
|
+ for (int i = listTag.size() - 1; i < listTag.size(); ++i) { // Paper - remove duplicate properties
|
|
|
|
CompoundTag compoundTag2 = listTag.getCompound(i);
|
|
|
|
String string3 = compoundTag2.getString("Value");
|
|
|
|
if (compoundTag2.contains("Signature", 8)) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/PlayerHeadItem.java b/src/main/java/net/minecraft/world/item/PlayerHeadItem.java
|
|
|
|
index 7fb2cc8d49a2d8f256f625cb99b66ef8efc3fc0e..f9980110a4614bb0206dce3dc796d9459069b750 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/item/PlayerHeadItem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/item/PlayerHeadItem.java
|
|
|
|
@@ -53,6 +53,18 @@ public class PlayerHeadItem extends StandingAndWallBlockItem {
|
|
|
|
});
|
|
|
|
// CraftBukkit start
|
|
|
|
} else {
|
|
|
|
+ // Paper start - clean up old duplicated properties
|
|
|
|
+ CompoundTag properties = nbt.getCompound("SkullOwner").getCompound("Properties");
|
|
|
|
+ for (String key : properties.getAllKeys()) {
|
|
|
|
+ net.minecraft.nbt.ListTag values = properties.getList(key, 10);
|
|
|
|
+ if (values.size() > 1) {
|
|
|
|
+ net.minecraft.nbt.Tag texture = values.get(values.size() - 1);
|
|
|
|
+ values = new net.minecraft.nbt.ListTag();
|
|
|
|
+ values.add(texture);
|
|
|
|
+ properties.put(key, values);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
net.minecraft.nbt.ListTag textures = nbt.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts
|
|
|
|
for (int i = 0; i < textures.size(); i++) {
|
|
|
|
if (textures.get(i) instanceof CompoundTag && !((CompoundTag) textures.get(i)).contains("Signature", 8) && ((CompoundTag) textures.get(i)).getString("Value").trim().isEmpty()) {
|