-
Type:
New Feature
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
None
-
This server is running CraftBukkit version 3423-Spigot-7fbc6a1-8f361ec (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT)
-
Yes
If you want to remove all enchantments from an ItemStack, right now the only way to do so is looping over getEnchantments().keySet() and remove every single enchantment individually.
Not only is that unnecessarily verbose code, but a removeAllEnchantments() method could internally use the clear() method of maps to remove values more efficiently, depending on the implementation.
Use cases are: Setting the enchantments of an ItemStack, overwriting previous ones, any "unenchant" functionality, etc.