From f931dfbaf156aabfa3586a106a852eb9dd964bef Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Sat, 25 Sep 2021 18:18:12 -0230 Subject: Fixed the regex for vanity armor giving the wrong suit name for lang lookup --- .../kotlin/tech/thatgravyboat/rewardclaim/types/RewardData.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/types/RewardData.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/types/RewardData.kt index 4695cbf..320f0b7 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/types/RewardData.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/types/RewardData.kt @@ -6,8 +6,7 @@ import tech.thatgravyboat.rewardclaim.RewardLanguage import java.util.* -private val ARMOR_PIECE_REGEX = Regex("^[a-z0-9_]+_([a-z]+)$", RegexOption.IGNORE_CASE) -private val ARMOR_REGEX = Regex("_([a-z]+)$", RegexOption.IGNORE_CASE) +private val ARMOR_REGEX = Regex("(^[a-z0-9_]+)_([a-z]+)$", RegexOption.IGNORE_CASE) data class RewardData( val rarity: RewardRarity, @@ -34,12 +33,11 @@ data class RewardData( } rewardKey?.let { key -> if (reward.equals("add_vanity", ignoreCase = true)) { - val pieceMatcher = ARMOR_PIECE_REGEX.find(key) val armorMatcher = ARMOR_REGEX.find(key) - if ("suit" in key && pieceMatcher != null && armorMatcher != null) { + if ("suit" in key && armorMatcher != null) { return "${rarity.color}${language.translate("vanity." + armorMatcher.groups[1]!!.value)} ${ language.translate( - "vanity.armor." + pieceMatcher.groups[1]!!.value + "vanity.armor." + armorMatcher.groups[2]!!.value ) }" } else if ("emote" in key || "taunt" in key) { -- cgit