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 aEnchantment
based on the entered information.level
(int level) Sets the level for this enchantment.default Enchantment.Builder
type
(Supplier<? extends EnchantmentType> enchantmentType) Sets theEnchantmentType
for this enchantment.type
(EnchantmentType enchantmentType) Sets theEnchantmentType
for this enchantment.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
Methods inherited from interface org.spongepowered.api.data.persistence.DataBuilder
build
-
Method Details
-
type
Sets theEnchantmentType
for this enchantment.- Parameters:
enchantmentType
- The desired enchantment type- Returns:
- The modified builder, for chaining
-
type
Sets theEnchantmentType
for 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_VALUE
andShort.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 than0
and less thanShort.MAX_VALUE
.- Parameters:
level
- The desired level- Returns:
- The modified builder for chaining
- Throws:
IllegalArgumentException
- If the level is smaller thanShort.MIN_VALUE
or larger thanShort.MAX_VALUE
-
build
Builds an instance of aEnchantment
based on the entered information.- Specified by:
build
in interfaceAbstractBuilder<Enchantment>
- Returns:
- The created enchantment
- Throws:
IllegalStateException
- If a required value was not specified
-