13
0
geforkt von Mirrors/Paper

SPIGOT-6961: Actually return a copy of the ItemMeta

By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-03-13 06:58:41 +11:00
Ursprung 5abfb14c7f
Commit cac50e9c55
7 geänderte Dateien mit 9 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -29,7 +29,7 @@ public class CraftMetaArmorStand extends CraftMetaItem {
super(tag); super(tag);
if (tag.contains(ENTITY_TAG.NBT)) { if (tag.contains(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT); entityTag = tag.getCompound(ENTITY_TAG.NBT).copy();
} }
} }

Datei anzeigen

@ -39,7 +39,7 @@ public class CraftMetaAxolotlBucket extends CraftMetaItem implements AxolotlBuck
} }
if (tag.contains(ENTITY_TAG.NBT)) { if (tag.contains(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT); entityTag = tag.getCompound(ENTITY_TAG.NBT).copy();
} }
} }

Datei anzeigen

@ -45,7 +45,7 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
this.material = material; this.material = material;
if (tag.contains(BLOCK_ENTITY_TAG.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) { if (tag.contains(BLOCK_ENTITY_TAG.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
blockEntityTag = tag.getCompound(BLOCK_ENTITY_TAG.NBT); blockEntityTag = tag.getCompound(BLOCK_ENTITY_TAG.NBT).copy();
} else { } else {
blockEntityTag = null; blockEntityTag = null;
} }

Datei anzeigen

@ -29,7 +29,7 @@ public class CraftMetaEntityTag extends CraftMetaItem {
super(tag); super(tag);
if (tag.contains(ENTITY_TAG.NBT)) { if (tag.contains(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT); entityTag = tag.getCompound(ENTITY_TAG.NBT).copy();
} }
} }

Datei anzeigen

@ -349,7 +349,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
customModelData = tag.getInt(CUSTOM_MODEL_DATA.NBT); customModelData = tag.getInt(CUSTOM_MODEL_DATA.NBT);
} }
if (tag.contains(BLOCK_DATA.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) { if (tag.contains(BLOCK_DATA.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {
blockData = tag.getCompound(BLOCK_DATA.NBT); blockData = tag.getCompound(BLOCK_DATA.NBT).copy();
} }
this.enchantments = buildEnchantments(tag, ENCHANTMENTS); this.enchantments = buildEnchantments(tag, ENCHANTMENTS);
@ -372,14 +372,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
NBTTagCompound compound = tag.getCompound(BUKKIT_CUSTOM_TAG.NBT); NBTTagCompound compound = tag.getCompound(BUKKIT_CUSTOM_TAG.NBT);
Set<String> keys = compound.getAllKeys(); Set<String> keys = compound.getAllKeys();
for (String key : keys) { for (String key : keys) {
persistentDataContainer.put(key, compound.get(key)); persistentDataContainer.put(key, compound.get(key).copy());
} }
} }
Set<String> keys = tag.getAllKeys(); Set<String> keys = tag.getAllKeys();
for (String key : keys) { for (String key : keys) {
if (!getHandledTags().contains(key)) { if (!getHandledTags().contains(key)) {
unhandledTags.put(key, tag.get(key)); unhandledTags.put(key, tag.get(key).copy());
} }
} }
} }

Datei anzeigen

@ -41,7 +41,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
super(tag); super(tag);
if (tag.contains(ENTITY_TAG.NBT)) { if (tag.contains(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT); entityTag = tag.getCompound(ENTITY_TAG.NBT).copy();
} }
} }

Datei anzeigen

@ -42,7 +42,7 @@ class CraftMetaTropicalFishBucket extends CraftMetaItem implements TropicalFishB
} }
if (tag.contains(ENTITY_TAG.NBT)) { if (tag.contains(ENTITY_TAG.NBT)) {
entityTag = tag.getCompound(ENTITY_TAG.NBT); entityTag = tag.getCompound(ENTITY_TAG.NBT).copy();
} }
} }