Class EnchantmentOffer
java.lang.Object
org.bukkit.enchantments.EnchantmentOffer
A class for the available enchantment offers in the enchantment table.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanintgetCost()Gets the cost (minimum level) which is displayed as a number on the right hand side of the enchantment offer.Get the type of the enchantment.intGets the level of the enchantment.inthashCode()static @Nullable EnchantmentOffer[]rollEnchantmentOffers(ItemStack targetStack, int seed, int bookshelfCount, int offerAmount) Rolls a new set of enchantment offers based on a target item stack, a seed and a bookshelf count.voidsetCost(@Positive int cost) Sets the cost (minimum level) which is displayed as a number on the right hand side of the enchantment offer.voidsetEnchantment(Enchantment enchantment) Sets the type of the enchantment.voidsetEnchantmentLevel(@Positive int enchantmentLevel) Sets the level of the enchantment.
-
Constructor Details
-
EnchantmentOffer
-
-
Method Details
-
getEnchantment
-
setEnchantment
Sets the type of the enchantment.- Parameters:
enchantment- type of the enchantment
-
getEnchantmentLevel
public int getEnchantmentLevel()Gets the level of the enchantment.- Returns:
- level of the enchantment
-
setEnchantmentLevel
public void setEnchantmentLevel(@Positive int enchantmentLevel) Sets the level of the enchantment.- Parameters:
enchantmentLevel- level of the enchantment
-
getCost
public int getCost()Gets the cost (minimum level) which is displayed as a number on the right hand side of the enchantment offer.- Returns:
- cost for this enchantment
-
setCost
public void setCost(@Positive int cost) Sets the cost (minimum level) which is displayed as a number on the right hand side of the enchantment offer.- Parameters:
cost- cost for this enchantment
-
equals
-
hashCode
-
rollEnchantmentOffers
public static @Nullable EnchantmentOffer[] rollEnchantmentOffers(ItemStack targetStack, int seed, int bookshelfCount, int offerAmount) Rolls a new set of enchantment offers based on a target item stack, a seed and a bookshelf count.- Parameters:
targetStack- the itemstack for which the enchantment offers are rolled.seed- the seed used for random selection of enchantments. MirrorsEnchantmentView.getEnchantmentSeed().bookshelfCount- the number of virtual bookshelves to consider when rolling the enchantments.offerAmount- the amount of enchantment offers to roll.- Returns:
- an array of enchantment offers with size
offerAmount.
-