9
0
mirror of https://github.com/HibiscusMC/HibiscusCommons.git synced 2025-12-19 15:09:26 +00:00

fix: item serializer not putting enchants on properly due to uppercase value

This commit is contained in:
LoJoSho
2024-05-29 12:59:57 -05:00
parent 3269d439c9
commit 581c826b7e

View File

@@ -102,8 +102,11 @@ public class ItemSerializer implements TypeSerializer<ItemStack> {
if (!enchantsNode.virtual()) { if (!enchantsNode.virtual()) {
for (ConfigurationNode enchantNode : enchantsNode.childrenMap().values()) { for (ConfigurationNode enchantNode : enchantsNode.childrenMap().values()) {
if (Enchantment.getByKey(NamespacedKey.minecraft(enchantNode.key().toString())) == null) continue; String enchantName = enchantNode.key().toString().toLowerCase();
itemMeta.addEnchant(Enchantment.getByKey(NamespacedKey.minecraft(enchantNode.key().toString())), enchantNode.getInt(1), true); NamespacedKey key = NamespacedKey.minecraft(enchantName);
Enchantment enchant = Enchantment.getByKey(key);
if (enchant == null) continue;
itemMeta.addEnchant(enchant, enchantNode.getInt(1), true);
} }
} }