Class EnchantmentUtil


  • public class EnchantmentUtil
    extends Object
    A class that has util methods to help retrieve enchantments from itemstacks
    • Constructor Detail

      • EnchantmentUtil

        public EnchantmentUtil()
    • Method Detail

      • isEnchanted

        public static boolean isEnchanted​(ItemStack item)
        Check if an item is enchanted
        Parameters:
        item - the item which you wish to check
        Returns:
        true if the item does have an enchantment otherwise false
      • isEnchantedBook

        public static boolean isEnchantedBook​(ItemStack item)
        Check if an item is an enchanted book
        Parameters:
        item - the item which you wish to check
        Returns:
        true if the item is an enchanted book otherwise false
      • getEnchantmentHolder

        public static EnchantmentHolder getEnchantmentHolder​(ItemStack item)
        Used to get enchantments off of an item
        Parameters:
        item - the item which you wish to check
        Returns:
        the enchantment holder, will create a new one if nothing is present
      • getEnchantedBook

        public static EnchantedBook getEnchantedBook​(ItemStack item)
        Returns an enchanted book object based on an itemstack
        Parameters:
        item - the enchanted book itemstack
        Returns:
        an enchanted book object based on said itemstack, null if itemstack is not an enchanted book