From 477fb2bb7257503a7c15d5f1e0857d4cbf26971f Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 26 Jun 2017 09:49:28 +1000 Subject: [PATCH] SPIGOT-3381: Save older serialized enchants --- .../org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 23f987bb99..ec92367302 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -431,8 +431,13 @@ class CraftMetaItem implements ItemMeta, Repairable { Map enchantments = new HashMap(ench.size()); for (Map.Entry entry : ench.entrySet()) { - Enchantment enchantment = Enchantment.getByName(entry.getKey().toString()); + // Doctor older enchants + String enchantKey = entry.getKey().toString(); + if (enchantKey.equals("SWEEPING")) { + enchantKey = "SWEEPING_EDGE"; + } + Enchantment enchantment = Enchantment.getByName(enchantKey); if ((enchantment != null) && (entry.getValue() instanceof Integer)) { enchantments.put(enchantment, (Integer) entry.getValue()); }