enchantIf

fun enchantIf(enchants: Map<Enchantment, Int>, condition: Boolean = false): ItemBuilder(source)

Add enchants if condition is true

Return

an instance of the ItemBuilder with the applied enchantments if condition is true, otherwise the same instance of ItemBuilder

Parameters

enchants

a map of enchantments to apply, where the key is the enchantment and the value is the level

condition

a boolean value indicating whether to apply the enchantments or not. Default is false.