From f26c35c63b7c40a849d2f50b5293cb1625e63469 Mon Sep 17 00:00:00 2001 From: _OfTeN_ Date: Mon, 23 Jan 2023 14:34:38 +0300 Subject: [PATCH] Added support for skulls, heads and pumpkins as helmets --- .../com/willfp/ecoarmor/sets/ArmorSlot.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoarmor/sets/ArmorSlot.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoarmor/sets/ArmorSlot.kt index e90c069..27912bf 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoarmor/sets/ArmorSlot.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoarmor/sets/ArmorSlot.kt @@ -20,19 +20,20 @@ enum class ArmorSlot( return null } val material = itemStack.type - val split = material.name.lowercase(Locale.getDefault()).split("_").toTypedArray() - return getSlot(split[split.size - 1]) + return getSlot(material.name) } @JvmStatic fun getSlot(name: String): ArmorSlot? { - return when (name.lowercase(Locale.getDefault())) { - "helmet" -> HELMET - "chestplate" -> CHESTPLATE - "elytra" -> ELYTRA - "leggings" -> LEGGINGS - "boots" -> BOOTS + return when { + name.contains("HELMET", true) || name.contains("HEAD", true) + || name.contains("SKULL", true) + || name.contains("PUMPKIN", true) -> HELMET + name.contains("CHESTPLATE", true) -> CHESTPLATE + name.contains("ELYTRA", true) -> ELYTRA + name.contains("LEGGINGS", true) -> LEGGINGS + name.contains("BOOTS", true) -> BOOTS else -> null } }