diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-04-04 20:32:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 20:32:01 +0200 |
commit | 52afdbf62ef5c35403132696918b9cfcc8faffdb (patch) | |
tree | 635ceff6fdd18b0f201be04c5e6d1661275adcb0 /src/main/java/at/hannibal2/skyhanni | |
parent | b9c0aaa585a913d5c139c8e5aa7437925b1acfa2 (diff) | |
download | skyhanni-52afdbf62ef5c35403132696918b9cfcc8faffdb.tar.gz skyhanni-52afdbf62ef5c35403132696918b9cfcc8faffdb.tar.bz2 skyhanni-52afdbf62ef5c35403132696918b9cfcc8faffdb.zip |
Backend: error manager only for beta users (#1299)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
3 files changed, 17 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 744b4fa45..d3e3b6c1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -807,16 +807,18 @@ private fun getFooterDisplayPair() = listOf( private fun getExtraDisplayPair(): List<ScoreboardElementType> { if (unknownLines.isEmpty()) return listOf("<hidden>" to HorizontalAlignment.LEFT) - if (amountOfUnknownLines != unknownLines.size && devConfig.unknownLinesWarning) { + val size = unknownLines.size + if (amountOfUnknownLines != size && devConfig.unknownLinesWarning) { + val message = "CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}" ErrorManager.logErrorWithData( - CustomScoreboardUtils.UndetectedScoreboardLines("CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}"), - "CustomScoreboard detected ${pluralize(unknownLines.size, "unknown line", withNumber = true)}", + CustomScoreboardUtils.UndetectedScoreboardLines(message), + message, "Unknown Lines" to unknownLines, "Island" to HypixelData.skyBlockIsland, "Area" to HypixelData.skyBlockArea, - noStackTrace = true + noStackTrace = true, ) - amountOfUnknownLines = unknownLines.size + amountOfUnknownLines = size } return listOf("§cUndetected Lines:" to HorizontalAlignment.LEFT) + unknownLines.map { it to HorizontalAlignment.LEFT } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt index 5b369a35c..e29674fe9 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/ErrorManager.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.KeyboardManager +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.OSUtils import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -87,8 +88,9 @@ object ErrorManager { vararg extraData: Pair<String, Any?>, ignoreErrorCache: Boolean = false, noStackTrace: Boolean = false, + betaOnly: Boolean = false, ) { - logError(IllegalStateException(internalMessage), userMessage, ignoreErrorCache, noStackTrace, *extraData) + logError(IllegalStateException(internalMessage), userMessage, ignoreErrorCache, noStackTrace, *extraData, betaOnly = betaOnly) } @Deprecated("Use data as well", ReplaceWith("ErrorManager.logErrorWithData(throwable, message)")) @@ -102,8 +104,9 @@ object ErrorManager { vararg extraData: Pair<String, Any?>, ignoreErrorCache: Boolean = false, noStackTrace: Boolean = false, + betaOnly: Boolean = false, ) { - logError(throwable, message, ignoreErrorCache, noStackTrace, *extraData) + logError(throwable, message, ignoreErrorCache, noStackTrace, *extraData, betaOnly = betaOnly) } private fun logError( @@ -112,7 +115,9 @@ object ErrorManager { ignoreErrorCache: Boolean, noStackTrace: Boolean, vararg extraData: Pair<String, Any?>, + betaOnly: Boolean = false, ) { + if (betaOnly && !LorenzUtils.isBetaVersion()) return if (!ignoreErrorCache) { val pair = if (throwable.stackTrace.isNotEmpty()) { throwable.stackTrace[0].let { (it.fileName ?: "<unknown>") to it.lineNumber } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 740c6acaf..9d65eca03 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.data.Perk import at.hannibal2.skyhanni.data.TitleManager import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.features.misc.update.UpdateManager import at.hannibal2.skyhanni.features.misc.visualwords.ModifyVisualWords import at.hannibal2.skyhanni.features.nether.kuudra.KuudraAPI import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign @@ -395,4 +396,6 @@ object LorenzUtils { fun inMiningIsland() = IslandType.GOLD_MINES.isInIsland() || IslandType.DEEP_CAVERNS.isInIsland() || inAdvancedMiningIsland() + + fun isBetaVersion() = UpdateManager.isCurrentlyBeta() } |