mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-25 06:03:03 +02:00
* Expose server build information * squash patches * final tweaks --------- Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: masmc05 <masmc05@gmail.com>
46 lines
2.6 KiB
Diff
46 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: SoSeDiK <mrsosedik@gmail.com>
|
|
Date: Thu, 26 May 2022 03:30:05 +0300
|
|
Subject: [PATCH] Deep clone nbt tags in PDC
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
index d90876888c2dedbdedd63cff932f48da286c8172..eba1c67abc2ace5913ab3ae8d732f8c68fd0f683 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
@@ -298,7 +298,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
this.damage = meta.damage;
|
|
this.maxDamage = meta.maxDamage;
|
|
this.unhandledTags = meta.unhandledTags;
|
|
- this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
|
+ this.persistentDataContainer.putAll(meta.persistentDataContainer.getTagsCloned()); // Paper - deep clone NBT tags
|
|
|
|
this.customTag = meta.customTag;
|
|
|
|
@@ -1563,7 +1563,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
|
if (this.customTag != null) {
|
|
clone.customTag = this.customTag.copy();
|
|
}
|
|
- clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getRaw(), CraftMetaItem.DATA_TYPE_REGISTRY);
|
|
+ clone.persistentDataContainer = new CraftPersistentDataContainer(this.persistentDataContainer.getTagsCloned(), CraftMetaItem.DATA_TYPE_REGISTRY); // Paper - deep clone NBT tags
|
|
clone.hideFlag = this.hideFlag;
|
|
clone.hideTooltip = this.hideTooltip;
|
|
clone.unbreakable = this.unbreakable;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
|
index 5a4e7e7150b7c137b077e0b393f17ed35b5aec34..f55fdd57ced259ad5a95878840e98ffaa3db2e05 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java
|
|
@@ -207,4 +207,12 @@ public class CraftPersistentDataContainer implements PersistentDataContainer {
|
|
}
|
|
}
|
|
// Paper end - byte array serialization
|
|
+
|
|
+ // Paper start - deep clone tags
|
|
+ public Map<String, Tag> getTagsCloned() {
|
|
+ final Map<String, Tag> tags = new HashMap<>();
|
|
+ this.customDataTags.forEach((key, tag) -> tags.put(key, tag.copy()));
|
|
+ return tags;
|
|
+ }
|
|
+ // Paper end - deep clone tags
|
|
}
|