Interface Enchantment
- All Superinterfaces:
- DataSerializable
Represents an 
EnchantmentType on an ItemStack that is paired
 with a level.
 The contract of enchantments is that their level will always be between
 Short.MIN_VALUE and Short.MAX_VALUE, but it is not guaranteed
 they will work properly outside of EnchantmentType.minimumLevel()
 and EnchantmentType.maximumLevel().
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a builder interface which can be used to create aEnchantment.static interfaceRepresents a builder interface which can be used to create aEnchantment.
- 
Method SummaryModifier and TypeMethodDescriptionstatic Enchantment.Builderbuilder()Creates a newEnchantment.Builderto create anEnchantment.intlevel()Gets the level of this enchantment.static Enchantmentof(Supplier<? extends EnchantmentType> enchantmentType, int level) Creates a newEnchantmentwith the providedEnchantmentTypeand level.static Enchantmentof(EnchantmentType enchantmentType, int level) Creates a newEnchantmentwith the providedEnchantmentTypeand level.Creates a newEnchantment.RandomListBuilderto create a random list ofEnchantments.type()Gets theEnchantmentTypefor this enchantment.Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializablecontentVersion, toContainer
- 
Method Details- 
builderCreates a newEnchantment.Builderto create anEnchantment.- Returns:
- The new builder
 
- 
randomListBuilderCreates a newEnchantment.RandomListBuilderto create a random list ofEnchantments.- Returns:
- The new random list builder
 
- 
ofstatic Enchantment of(Supplier<? extends EnchantmentType> enchantmentType, int level) throws IllegalArgumentException Creates a newEnchantmentwith the providedEnchantmentTypeand level.- Parameters:
- enchantmentType- The enchantment type
- level- The enchantment level
- Returns:
- The created enchantment
- Throws:
- IllegalArgumentException- If the level is smaller than- Short.MIN_VALUEor larger than- Short.MAX_VALUE
 
- 
ofCreates a newEnchantmentwith the providedEnchantmentTypeand level.- Parameters:
- enchantmentType- The enchantment type
- level- The enchantment level
- Returns:
- The created enchantment
- Throws:
- IllegalArgumentException- If the level is smaller than- Short.MIN_VALUEor larger than- Short.MAX_VALUE
 
- 
typeEnchantmentType type()Gets theEnchantmentTypefor this enchantment.- Returns:
- The enchantment type of this enchantment
 
- 
levelint level()Gets the level of this enchantment.- Returns:
- The level of this enchantment
 
 
-