summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThatGravyBoat <thatgravyboat@gmail.com>2021-09-25 18:18:12 -0230
committerThatGravyBoat <thatgravyboat@gmail.com>2021-09-25 18:18:12 -0230
commitf931dfbaf156aabfa3586a106a852eb9dd964bef (patch)
tree3faf8c77da20b91a1ceea0dbf72100d4afd1488b /src
parentcd58f0b8fadefdb0026347649bb78b93274e4194 (diff)
downloadRewardClaim-f931dfbaf156aabfa3586a106a852eb9dd964bef.tar.gz
RewardClaim-f931dfbaf156aabfa3586a106a852eb9dd964bef.tar.bz2
RewardClaim-f931dfbaf156aabfa3586a106a852eb9dd964bef.zip
Fixed the regex for vanity armor giving the wrong suit name for lang lookup
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/tech/thatgravyboat/rewardclaim/types/RewardData.kt8
1 files changed, 3 insertions, 5 deletions
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) {