Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6921

ItemStack removeAllEnchantments

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 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.

            Unassigned Unassigned
            Photon Photon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: