mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-20 23:46:57 +01:00
SPIGOT-6630: Replacing an enchantment on an item creates a conflict error
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
44cc499340
commit
8a60b49a31
1 changed files with 3 additions and 2 deletions
|
@ -9,6 +9,7 @@ import net.minecraft.world.item.Item;
|
|||
import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
|
||||
import org.bukkit.craftbukkit.util.CraftLegacy;
|
||||
|
@ -190,7 +191,7 @@ public final class CraftItemStack extends ItemStack {
|
|||
for (int i = 0; i < size; i++) {
|
||||
NBTTagCompound tag = (NBTTagCompound) list.get(i);
|
||||
String id = tag.getString(ENCHANTMENTS_ID.NBT);
|
||||
if (id.equals(ench.getKey().toString())) {
|
||||
if (ench.getKey().equals(NamespacedKey.fromString(id))) {
|
||||
tag.setShort(ENCHANTMENTS_LVL.NBT, (short) level);
|
||||
return;
|
||||
}
|
||||
|
@ -242,7 +243,7 @@ public final class CraftItemStack extends ItemStack {
|
|||
for (int i = 0; i < size; i++) {
|
||||
NBTTagCompound enchantment = (NBTTagCompound) list.get(i);
|
||||
String id = enchantment.getString(ENCHANTMENTS_ID.NBT);
|
||||
if (id.equals(ench.getKey().toString())) {
|
||||
if (ench.getKey().equals(NamespacedKey.fromString(id))) {
|
||||
index = i;
|
||||
level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue