Prevent NPE when removing enchantment with no ItemMeta (#6459)

This commit is contained in:
Jake Potrebic 2021-08-22 08:13:51 -07:00
parent 9169cf73cc
commit b9871610d1

View File

@ -183,6 +183,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- }
+ // Paper start - replace entire method
+ final ItemMeta itemMeta = this.getItemMeta();
+ if (itemMeta == null) return 0;
+ int level = itemMeta.getEnchantLevel(ench);
+ if (level > 0) {
+ itemMeta.removeEnchant(ench);