diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt index 171a61d9..6552a075 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/target/EnchantmentTarget.kt @@ -11,6 +11,7 @@ import com.willfp.libreforge.slot.SlotTypes import com.willfp.libreforge.slot.impl.SlotTypeAny import org.bukkit.entity.Player import org.bukkit.inventory.ItemStack +import java.lang.IllegalArgumentException import java.util.Objects interface EnchantmentTarget : Registrable { @@ -39,7 +40,8 @@ class ConfiguredEnchantmentTarget( override val id = config.getString("id") override val displayName = config.getFormattedString("display-name") - override val slot = SlotTypes[config.getString("slot")]!! + override val slot = SlotTypes[config.getString("slot")] ?: + throw IllegalArgumentException("Invalid slot type: ${config.getString("slot")}, options are ${SlotTypes.values().map { it.id }}") override val items = config.getStrings("items") .map { Items.lookup(it) } diff --git a/eco-core/core-plugin/src/main/resources/targets.yml b/eco-core/core-plugin/src/main/resources/targets.yml index 725cc978..59fb2b6f 100644 --- a/eco-core/core-plugin/src/main/resources/targets.yml +++ b/eco-core/core-plugin/src/main/resources/targets.yml @@ -176,7 +176,7 @@ targets: - id: shield display-name: "Shields" - slot: mainhands + slot: hands items: - "*shield"