Interface Enchantment.Builder
- All Superinterfaces:
AbstractBuilder<Enchantment>,Builder<Enchantment,,Enchantment.Builder> CopyableBuilder<Enchantment,,Enchantment.Builder> DataBuilder<Enchantment>,ResettableBuilder<Enchantment,Enchantment.Builder>
- Enclosing interface:
- Enchantment
public static interface Enchantment.Builder
extends Builder<Enchantment,Enchantment.Builder>, CopyableBuilder<Enchantment,Enchantment.Builder>, DataBuilder<Enchantment>
Represents a builder interface which can be used
to create a
Enchantment.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an instance of aEnchantmentbased on the entered information.level(int level) Sets the level for this enchantment.default Enchantment.Buildertype(Supplier<? extends EnchantmentType> enchantmentType) Sets theEnchantmentTypefor this enchantment.type(EnchantmentType enchantmentType) Sets theEnchantmentTypefor this enchantment.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
fromMethods inherited from interface org.spongepowered.api.data.persistence.DataBuilder
build
-
Method Details
-
type
Sets theEnchantmentTypefor this enchantment.- Parameters:
enchantmentType- The desired enchantment type- Returns:
- The modified builder, for chaining
-
type
Sets theEnchantmentTypefor this enchantment.- Parameters:
enchantmentType- The desired enchantment type- Returns:
- The modified builder, for chaining
-
level
Sets the level for this enchantment.This level must be between
Short.MIN_VALUEandShort.MAX_VALUE, but there is no guarantee all levels will work properly without error. It is recommended for reliable results you stay betweenEnchantmentType.minimumLevel()andEnchantmentType.maximumLevel(), or at least larger than0and less thanShort.MAX_VALUE.- Parameters:
level- The desired level- Returns:
- The modified builder for chaining
- Throws:
IllegalArgumentException- If the level is smaller thanShort.MIN_VALUEor larger thanShort.MAX_VALUE
-
build
Builds an instance of aEnchantmentbased on the entered information.- Specified by:
buildin interfaceAbstractBuilder<Enchantment>- Returns:
- The created enchantment
- Throws:
IllegalStateException- If a required value was not specified
-