Fixed targets

This commit is contained in:
Auxilor 2023-09-01 13:01:19 +01:00
parent 39076eef7a
commit d5bd2b3efd
2 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import com.willfp.libreforge.slot.SlotTypes
import com.willfp.libreforge.slot.impl.SlotTypeAny import com.willfp.libreforge.slot.impl.SlotTypeAny
import org.bukkit.entity.Player import org.bukkit.entity.Player
import org.bukkit.inventory.ItemStack import org.bukkit.inventory.ItemStack
import java.lang.IllegalArgumentException
import java.util.Objects import java.util.Objects
interface EnchantmentTarget : Registrable { interface EnchantmentTarget : Registrable {
@ -39,7 +40,8 @@ class ConfiguredEnchantmentTarget(
override val id = config.getString("id") override val id = config.getString("id")
override val displayName = config.getFormattedString("display-name") 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") override val items = config.getStrings("items")
.map { Items.lookup(it) } .map { Items.lookup(it) }

View File

@ -176,7 +176,7 @@ targets:
- id: shield - id: shield
display-name: "Shields" display-name: "Shields"
slot: mainhands slot: hands
items: items:
- "*shield" - "*shield"