Interface Enchantment.Builder
-
- All Superinterfaces:
AbstractBuilder<Enchantment>,Buildable.Builder<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 aEnchantment.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Enchantmentbuild()Builds an instance of aEnchantmentbased on the entered information.Enchantment.Builderlevel(int level)Sets the level for this enchantment.default Enchantment.Buildertype(java.util.function.Supplier<? extends EnchantmentType> enchantmentType)Sets theEnchantmentTypefor this enchantment.Enchantment.Buildertype(EnchantmentType enchantmentType)Sets theEnchantmentTypefor this enchantment.-
Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Methods inherited from interface org.spongepowered.api.data.persistence.DataBuilder
build
-
-
-
-
Method Detail
-
type
Enchantment.Builder type(EnchantmentType enchantmentType)
Sets theEnchantmentTypefor this enchantment.- Parameters:
enchantmentType- The desired enchantment type- Returns:
- The modified builder, for chaining
-
type
default Enchantment.Builder type(java.util.function.Supplier<? extends EnchantmentType> enchantmentType)
Sets theEnchantmentTypefor this enchantment.- Parameters:
enchantmentType- The desired enchantment type- Returns:
- The modified builder, for chaining
-
level
Enchantment.Builder level(int level) throws java.lang.IllegalArgumentException
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:
java.lang.IllegalArgumentException- If the level is smaller thanShort.MIN_VALUEor larger thanShort.MAX_VALUE
-
build
Enchantment build() throws java.lang.IllegalStateException
Builds an instance of aEnchantmentbased on the entered information.- Specified by:
buildin interfaceAbstractBuilder<Enchantment>- Specified by:
buildin interfaceBuildable.Builder<Enchantment>- Returns:
- The created enchantment
- Throws:
java.lang.IllegalStateException- If a required value was not specified
-
-