aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2023-11-01 10:40:04 +0100
committerGitHub <noreply@github.com>2023-11-01 10:40:04 +0100
commit2efa126057236a912d5b413676f714545e661862 (patch)
tree7c9974a117108ae6e34bef2f12bc625113f5462d /src/main/java/at/hannibal2
parente29e4ba99b3625061d434517065551dc250b975f (diff)
downloadskyhanni-2efa126057236a912d5b413676f714545e661862.tar.gz
skyhanni-2efa126057236a912d5b413676f714545e661862.tar.bz2
skyhanni-2efa126057236a912d5b413676f714545e661862.zip
Fixed Great Spook Potion not working in Non God Pot effect feature (#658)
Fixed Great Spook potion not working in Non God Pot Effect feature. #658
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt4
2 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
index a1ae6f5ad..f4ce726f4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
@@ -70,31 +70,31 @@ class NonGodPotEffectDisplay {
}
if (event.message == "§aYou ate a §r§aRe-heated Gummy Polar Bear§r§a!") {
- checkFooter = true
effectDuration[NonGodPotEffect.SMOLDERING] = Timer(1.hours)
update()
}
if (event.message == "§a§lBUFF! §fYou have gained §r§2Mushed Glowy Tonic I§r§f! Press TAB or type /effects to view your active effects!") {
- checkFooter = true
effectDuration[NonGodPotEffect.GLOWY] = Timer(1.hours)
update()
}
if (event.message == "§a§lBUFF! §fYou splashed yourself with §r§bWisp's Ice-Flavored Water I§r§f! Press TAB or type /effects to view your active effects!") {
- checkFooter = true
effectDuration[NonGodPotEffect.WISP] = Timer(5.minutes)
update()
}
+ if (event.message == "§eYou consumed a §r§fGreat Spook Potion§r§e!") {
+ effectDuration[NonGodPotEffect.GREAT_SPOOK] = Timer(24.hours)
+ update()
+ }
+
if (event.message == "§e[NPC] §6King Yolkar§f: §rThese eggs will help me stomach my pain.") {
- checkFooter = true
effectDuration[NonGodPotEffect.GOBLIN] = Timer(20.minutes)
update()
}
if (event.message == "§cThe Goblin King's §r§afoul stench §r§chas dissipated!") {
- checkFooter = true
effectDuration.remove(NonGodPotEffect.GOBLIN)
update()
}
@@ -199,9 +199,11 @@ class NonGodPotEffectDisplay {
var effectsCount = 0
for (line in lines) {
for (effect in NonGodPotEffect.entries) {
- if (line.startsWith(effect.tabListName)) {
+ val tabListName = effect.tabListName
+ if (line.startsWith(tabListName)) {
+ val string = line.substring(tabListName.length)
try {
- val duration = TimeUtils.getMillis(line.split("§f")[1])
+ val duration = TimeUtils.getMillis(string.split("§f")[1])
effectDuration[effect] = Timer(duration.milliseconds)
update()
} catch (e: IndexOutOfBoundsException) {
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
index 33a9bbe83..3a32b3de6 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
@@ -74,7 +74,7 @@ object TimeUtils {
}
// TODO: use kotlin Duration
- fun getMillis(string: String) = getMillis_(string.replace("m", "m ").replace(" ", " "))
+ fun getMillis(string: String) = getMillis_(string.replace("m", "m ").replace(" ", " ").trim())
private fun getMillis_(string: String) = pattern.matchMatcher(string.lowercase().trim()) {
val years = group("y")?.toLong() ?: 0L
@@ -148,4 +148,4 @@ enum class TimeUnit(val factor: Long, val shortName: String, val longName: Strin
MINUTE(FACTOR_MINUTES, "m", "Minute"),
SECOND(FACTOR_SECONDS, "s", "Second"),
;
-} \ No newline at end of file
+}