aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt9
2 files changed, 15 insertions, 5 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 8fe96ca4e..723a3d00e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.events.ProfileApiDataLoadedEvent
+import at.hannibal2.skyhanni.test.command.CopyErrorCommand
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -149,7 +150,15 @@ class NonGodPotEffectDisplay {
if (name == effect.displayName) continue
for (line in stack.getLore()) {
if (line.contains("Remaining")) {
- val duration = TimeUtils.getMillis(line.split("§f")[1])
+ val duration = try {
+ TimeUtils.getMillis(line.split("§f")[1])
+ } catch (e: IndexOutOfBoundsException) {
+ CopyErrorCommand.logError(
+ Exception("'§f' not found in line '$line'", e),
+ "Error while reading Non God-Potion effects from tab list"
+ )
+ continue
+ }
effectDuration[effect] = System.currentTimeMillis() + duration
update()
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
index 6820deba7..c2a35027d 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt
@@ -31,13 +31,14 @@ object CopyErrorCommand {
if (cache.getIfPresent(pair) != null) return
cache.put(pair, Unit)
- val errorMessage = error.toString()
- val stackTrace = error.stackTrace.asList().joinToString("\n")
+ val stackTrace = error.stackTraceToString()
val randomId = UUID.randomUUID().toString()
- errorMessages[randomId] = "```$errorMessage\nCaused at:\n$stackTrace```"
+
+ errorMessages[randomId] =
+ "```\nSkyHanni ${SkyHanniMod.version}: $message\n$stackTrace```"
LorenzUtils.clickableChat(
- "§cSkyHanni ${SkyHanniMod.version} $message. Click here to copy the error into the clipboard.",
+ "§c[SkyHanni ${SkyHanniMod.version}]: $message. Click here to copy the error into the clipboard.",
"shcopyerror $randomId"
)
}