From e66f45ac7ea014bcf579b7a3d56033d082ebb763 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:07:59 +0100 Subject: Improvement: HoverTips improvements (#821) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/combat/ghostcounter/GhostCounter.kt | 4 +- .../garden/farming/FarmingWeightDisplay.kt | 42 +-- .../features/skillprogress/SkillProgress.kt | 17 +- .../at/hannibal2/skyhanni/utils/LorenzColor.kt | 2 +- .../at/hannibal2/skyhanni/utils/RenderUtils.kt | 21 ++ .../utils/renderables/RenderLineTooltips.kt | 309 ++++++++++----------- .../skyhanni/utils/renderables/Renderable.kt | 36 ++- .../skyhanni/utils/tracker/SkyHanniItemTracker.kt | 4 +- .../skyhanni/utils/tracker/SkyHanniTracker.kt | 12 +- 9 files changed, 229 insertions(+), 218 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index dd226d800..106d6e84d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -284,8 +284,8 @@ object GhostCounter { } val moneyMadeWithClickableTips = Renderable.clickAndHover( textFormatting.moneyMadeFormat.formatText(moneyMade.addSeparators()), - moneyMadeTips - ) { OSUtils.copyToClipboard(moneyMadeTips.joinToString("\n").removeColor()) } + moneyMadeTips, onClick = + { OSUtils.copyToClipboard(moneyMadeTips.joinToString("\n").removeColor()) }) addAsSingletonList(textFormatting.moneyHourFormat.formatText(final)) addAsSingletonList(moneyMadeWithClickableTips) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index ebcda2824..458806e21 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -131,18 +131,18 @@ class FarmingWeightDisplay { listOf("§eClick here to reload the data right now!"), onClick = recalculate ), Renderable.clickAndHover( - "§cdata from Elite Farmers!", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ), Renderable.clickAndHover( - "§eRejoin the garden or", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ), Renderable.clickAndHover( - "§eclick here to fix it.", - listOf("§eClick here to reload the data right now!"), - onClick = recalculate - ) + "§cdata from Elite Farmers!", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate + ), Renderable.clickAndHover( + "§eRejoin the garden or", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate + ), Renderable.clickAndHover( + "§eclick here to fix it.", + listOf("§eClick here to reload the data right now!"), + onClick = recalculate + ) ) } @@ -177,12 +177,13 @@ class FarmingWeightDisplay { val leaderboard = getLeaderboard() val list = mutableListOf() - list.add(Renderable.clickAndHover( - "§6Farming Weight§7: $weight$leaderboard", - listOf("§eClick to open your Farming Profile.") - ) { - openWebsite(LorenzUtils.getPlayerName()) - }) + list.add( + Renderable.clickAndHover( + "§6Farming Weight§7: $weight$leaderboard", + listOf("§eClick to open your Farming Profile."), onClick = { + openWebsite(LorenzUtils.getPlayerName()) + }) + ) if (isEtaEnabled() && (weightPerSecond != -1.0 || config.overtakeETAAlways)) { getETA()?.let { @@ -305,10 +306,9 @@ class FarmingWeightDisplay { } else { Renderable.clickAndHover( text, - listOf("§eClick to open the Farming Profile of §b$nextName.") - ) { + listOf("§eClick to open the Farming Profile of §b$nextName."), onClick = { openWebsite(nextName) - } + }) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt index ca9c5b5fe..ceb8f1922 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt @@ -374,17 +374,16 @@ object SkillProgress { ) } - val session = xpInfo.timeActive.seconds.format(TimeUnit.HOUR) add( - Renderable.clickAndHover( - "§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}", - listOf("§eClick to reset!") - ) { - xpInfo.sessionTimerActive = false - xpInfo.timeActive = 0L - chat("Timer for §b${activeSkill.displayName} §ehas been reset!") - }) + Renderable.clickAndHover("§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}", + listOf("§eClick to reset!"), onClick = { + xpInfo.sessionTimerActive = false + + xpInfo.timeActive = 0L + chat("Timer for §b${activeSkill.displayName} §ehas been reset!") + }) + ) } private fun drawDisplay() = buildList { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt index 717acf98d..e577ba28f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzColor.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import net.minecraft.item.EnumDyeColor import java.awt.Color -enum class LorenzColor(private val chatColorCode: Char, private val color: Color, private val coloredLabel: String) { +enum class LorenzColor(val chatColorCode: Char, private val color: Color, private val coloredLabel: String) { BLACK('0', Color(0, 0, 0), "§0Black"), DARK_BLUE('1', Color(0, 0, 170), "§1Dark Blue"), DARK_GREEN('2', Color(0, 170, 0), "§2Dark Green"), diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index d40f98667..53a228625 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -18,6 +18,7 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.FontRenderer import net.minecraft.client.gui.Gui import net.minecraft.client.gui.ScaledResolution +import net.minecraft.client.renderer.GLAllocation import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.Tessellator import net.minecraft.client.renderer.vertex.DefaultVertexFormats @@ -48,10 +49,13 @@ object RenderUtils { return value } } + enum class VerticalAlignment { TOP, CENTER, BOTTOM } private val beaconBeam = ResourceLocation("textures/entity/beacon_beam.png") + private val matrixBuffer = GLAllocation.createDirectFloatBuffer(16); + infix fun Slot.highlight(color: LorenzColor) { highlight(color.toColor()) } @@ -115,6 +119,23 @@ object RenderUtils { GlStateManager.enableCull() } + val absoluteTranslation + get() = run { + matrixBuffer.clear() + + GlStateManager.getFloat(GL11.GL_MODELVIEW_MATRIX, matrixBuffer) + + val read = generateSequence(0) { it + 1 }.take(16).map { matrixBuffer.get() }.toList() + + val xTranslate = read[12].toInt() + val yTranslate = read[13].toInt() + val zTranslate = read[14].toInt() + + matrixBuffer.flip() + + Triple(xTranslate, yTranslate, zTranslate) + } + fun getViewerPos(partialTicks: Float) = exactLocation(Minecraft.getMinecraft().renderViewEntity, partialTicks) fun AxisAlignedBB.expandBlock() = expand(0.0020000000949949026, 0.0020000000949949026, 0.0020000000949949026) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt index ec39dc7af..1f3267a62 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/RenderLineTooltips.kt @@ -1,6 +1,9 @@ package at.hannibal2.skyhanni.utils.renderables import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.RenderUtils +import at.hannibal2.skyhanni.utils.renderables.RenderableUtils.renderXAligned import io.github.moulberry.notenoughupdates.util.Utils import net.minecraft.client.Minecraft import net.minecraft.client.gui.ScaledResolution @@ -14,180 +17,152 @@ import java.awt.Color object RenderLineTooltips { fun drawHoveringText( - posX: Int, posY: Int, tips: List, stack: ItemStack? = null, + posX: Int, posY: Int, + tips: List, + stack: ItemStack? = null, + borderColor: LorenzColor? = null, + snapsToTopIfToLong: Boolean = true, mouseX: Int = Utils.getMouseX(), mouseY: Int = Utils.getMouseY(), ) { - if (tips.isNotEmpty()) { - var textLines = tips - val x = mouseX + 12 - posX - val y = mouseY - 10 - posY - val color: Char = stack?.getLore()?.lastOrNull()?.take(4)?.get(1) - ?: Utils.getPrimaryColourCode(textLines[0]) - val colourInt = Minecraft.getMinecraft().fontRendererObj.getColorCode(color) - val borderColorStart = Color(colourInt).darker().rgb and 0x00FFFFFF or (200 shl 24) - val font = Minecraft.getMinecraft().fontRendererObj - val scaled = ScaledResolution(Minecraft.getMinecraft()) - GlStateManager.disableRescaleNormal() - RenderHelper.disableStandardItemLighting() - GlStateManager.disableLighting() - GlStateManager.enableDepth() - var tooltipTextWidth = 0 - for (textLine in textLines) { - val textLineWidth = font.getStringWidth(textLine) - if (textLineWidth > tooltipTextWidth) { - tooltipTextWidth = textLineWidth - } - } - var needsWrap = false - var titleLinesCount = 1 - var tooltipX = x - if (tooltipX + tooltipTextWidth + 4 > scaled.scaledWidth) { - tooltipX = x - 16 - tooltipTextWidth - if (tooltipX < 4) { - tooltipTextWidth = if (x > scaled.scaledWidth / 2) { - x - 12 - 8 - } else { - scaled.scaledWidth - 16 - x - } - needsWrap = true - } - } - if (needsWrap) { - var wrappedTooltipWidth = 0 - val wrappedTextLines = mutableListOf() - for (i in textLines.indices) { - val textLine = textLines[i] - val wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth) - if (i == 0) { - titleLinesCount = wrappedLine.size - } - for (line in wrappedLine) { - val lineWidth = font.getStringWidth(line) - if (lineWidth > wrappedTooltipWidth) { - wrappedTooltipWidth = lineWidth - } - wrappedTextLines.add(line) - } - } - tooltipTextWidth = wrappedTooltipWidth - textLines = wrappedTextLines.toList() - tooltipX = if (x > scaled.scaledWidth / 2) { - x - 16 - tooltipTextWidth - } else { - x + 12 - } - } - var tooltipY = y - 12 - var tooltipHeight = 8 - if (textLines.size > 1) { - tooltipHeight += (textLines.size - 1) * 10 - if (textLines.size > titleLinesCount) { - tooltipHeight += 2 - } - } + if (tips.isEmpty()) return + + val (xTranslate, yTranslate, _) = RenderUtils.absoluteTranslation + + val x = mouseX - posX + 12 + val y = mouseY - posY - if (tips.size > 1) 2 else -7 + val color: Char = borderColor?.chatColorCode ?: stack?.getLore()?.lastOrNull()?.take(4)?.get(1) + ?: 'f' + val colourInt = Minecraft.getMinecraft().fontRendererObj.getColorCode(color) + val borderColorStart = Color(colourInt).darker().rgb and 0x00FFFFFF or (200 shl 24) + val scaled = ScaledResolution(Minecraft.getMinecraft()) + + val tooltipTextWidth = tips.maxOf { it.width } + val tooltipHeight = tips.sumOf { it.height } - if (tooltipY + tooltipHeight + 6 > scaled.scaledHeight) { - tooltipY = scaled.scaledHeight - tooltipHeight - 6 + val tooltipY = when { + y + yTranslate < 16 -> -yTranslate + 4 // Limit Top + y + yTranslate + tooltipHeight > scaled.scaledHeight -> { + if (snapsToTopIfToLong && tooltipHeight + 8 > scaled.scaledHeight) + -yTranslate + 4 // Snap to Top if to Long + else + scaled.scaledHeight - tooltipHeight - 4 - yTranslate // Limit Bottom } - val zLevel = 300 - val backgroundColor = -0xfeffff0 - drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 4, - tooltipX + tooltipTextWidth + 3, - tooltipY - 3, - backgroundColor, - backgroundColor - ) - drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY + tooltipHeight + 3, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 4, - backgroundColor, - backgroundColor - ) - drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 3, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3, - backgroundColor, - backgroundColor - ) - drawGradientRect( - zLevel, - tooltipX - 4, - tooltipY - 3, - tooltipX - 3, - tooltipY + tooltipHeight + 3, - backgroundColor, - backgroundColor - ) - drawGradientRect( - zLevel, - tooltipX + tooltipTextWidth + 3, - tooltipY - 3, - tooltipX + tooltipTextWidth + 4, - tooltipY + tooltipHeight + 3, - backgroundColor, - backgroundColor - ) - val borderColorEnd = borderColorStart and 0xFEFEFE shr 1 or (borderColorStart and -0x1000000) - drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 3 + 1, - tooltipX - 3 + 1, - tooltipY + tooltipHeight + 3 - 1, - borderColorStart, - borderColorEnd - ) - drawGradientRect( - zLevel, - tooltipX + tooltipTextWidth + 2, - tooltipY - 3 + 1, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3 - 1, - borderColorStart, - borderColorEnd - ) - drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY - 3, - tooltipX + tooltipTextWidth + 3, - tooltipY - 3 + 1, - borderColorStart, - borderColorStart - ) - drawGradientRect( - zLevel, - tooltipX - 3, - tooltipY + tooltipHeight + 2, - tooltipX + tooltipTextWidth + 3, - tooltipY + tooltipHeight + 3, - borderColorEnd, - borderColorEnd - ) - GlStateManager.disableDepth() - for (lineNumber in textLines.indices) { - val line = textLines[lineNumber] - font.drawStringWithShadow(line, 1f + tooltipX.toFloat(), 1f + tooltipY.toFloat(), -1) - if (lineNumber + 1 == titleLinesCount) { - tooltipY += 2 - } - tooltipY += 10 + + else -> { + y - 12 // normal } - GlStateManager.enableLighting() - GlStateManager.enableDepth() - RenderHelper.enableStandardItemLighting() - GlStateManager.enableRescaleNormal() } + val tooltipX = if (x + tooltipTextWidth + 4 + xTranslate > scaled.scaledWidth) { + scaled.scaledWidth - tooltipTextWidth - 4 - xTranslate // Limit Right + } else { + x // normal + } + + GlStateManager.disableRescaleNormal() + RenderHelper.disableStandardItemLighting() + GlStateManager.enableDepth() + + val zLevel = 300 + val backgroundColor = -0xfeffff0 + drawGradientRect( + zLevel, + tooltipX - 3, + tooltipY - 4, + tooltipX + tooltipTextWidth + 3, + tooltipY - 3, + backgroundColor, + backgroundColor + ) + drawGradientRect( + zLevel, + tooltipX - 3, + tooltipY + tooltipHeight + 3, + tooltipX + tooltipTextWidth + 3, + tooltipY + tooltipHeight + 4, + backgroundColor, + backgroundColor + ) + drawGradientRect( + zLevel, + tooltipX - 3, + tooltipY - 3, + tooltipX + tooltipTextWidth + 3, + tooltipY + tooltipHeight + 3, + backgroundColor, + backgroundColor + ) + drawGradientRect( + zLevel, + tooltipX - 4, + tooltipY - 3, + tooltipX - 3, + tooltipY + tooltipHeight + 3, + backgroundColor, + backgroundColor + ) + drawGradientRect( + zLevel, + tooltipX + tooltipTextWidth + 3, + tooltipY - 3, + tooltipX + tooltipTextWidth + 4, + tooltipY + tooltipHeight + 3, + backgroundColor, + backgroundColor + ) + val borderColorEnd = borderColorStart and 0xFEFEFE shr 1 or (borderColorStart and -0x1000000) + drawGradientRect( + zLevel, + tooltipX - 3, + tooltipY - 3 + 1, + tooltipX - 3 + 1, + tooltipY + tooltipHeight + 3 - 1, + borderColorStart, + borderColorEnd + ) + drawGradientRect( + zLevel, + tooltipX + tooltipTextWidth + 2, + tooltipY - 3 + 1, + tooltipX + tooltipTextWidth + 3, + tooltipY + tooltipHeight + 3 - 1, + borderColorStart, + borderColorEnd + ) + drawGradientRect( + zLevel, + tooltipX - 3, + tooltipY - 3, + tooltipX + tooltipTextWidth + 3, + tooltipY - 3 + 1, + borderColorStart, + borderColorStart + ) + drawGradientRect( + zLevel, + tooltipX - 3, + tooltipY + tooltipHeight + 2, + tooltipX + tooltipTextWidth + 3, + tooltipY + tooltipHeight + 3, + borderColorEnd, + borderColorEnd + ) + GlStateManager.disableDepth() + GlStateManager.translate(tooltipX.toFloat(), tooltipY.toFloat(), 0f) + + var yTranslateSum = 0 + for (line in tips) { + line.renderXAligned(tooltipX, tooltipY, tooltipTextWidth) + val yShift = line.height + GlStateManager.translate(0f, yShift.toFloat(), 0f) + yTranslateSum += yShift + } + + GlStateManager.translate(-tooltipX.toFloat(), -tooltipY.toFloat() + yTranslateSum.toFloat(), 0f) + GlStateManager.enableLighting() + GlStateManager.enableDepth() + RenderHelper.enableStandardItemLighting() + GlStateManager.enableRescaleNormal() GlStateManager.disableLighting() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt index 0874d1cf2..8a57ded54 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt @@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.features.chroma.ChromaShaderManager import at.hannibal2.skyhanni.features.chroma.ChromaType import at.hannibal2.skyhanni.utils.ColorUtils import at.hannibal2.skyhanni.utils.ColorUtils.darker +import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.NEUItems.renderOnScreen import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment @@ -96,12 +97,17 @@ interface Renderable { } fun clickAndHover( - text: String, - tips: List, + text: Any, + tips: List, bypassChecks: Boolean = false, onClick: () -> Unit, + onHover: () -> Unit = {}, ): Renderable { - return clickable(hoverTips(text, tips, bypassChecks = bypassChecks), onClick, bypassChecks = bypassChecks) + return clickable( + hoverTips(text, tips, bypassChecks = bypassChecks, onHover = onHover), + onClick, + bypassChecks = bypassChecks + ) } fun clickable( @@ -134,34 +140,44 @@ interface Renderable { } fun hoverTips( - text: String, - tips: List, + content: Any, + tips: List, indexes: List = listOf(), stack: ItemStack? = null, + color: LorenzColor? = null, bypassChecks: Boolean = false, + snapsToTopIfToLong: Boolean = true, condition: () -> Boolean = { true }, + onHover: () -> Unit = {}, ): Renderable { - val render = string(text) + val render = fromAny(content) ?: string("Error") return object : Renderable { override val width = render.width override val height = render.height override val horizontalAlign = render.horizontalAlign override val verticalAlign = render.verticalAlign + val tipsRender = tips.mapNotNull { fromAny(it) } + override fun render(posX: Int, posY: Int) { render.render(posX, posY) if (isHovered(posX, posY)) { if (condition() && shouldAllowLink(true, bypassChecks)) { + onHover.invoke() list[Pair(posX, posY)] = indexes GlStateManager.pushMatrix() GlStateManager.translate(0F, 0F, 400F) RenderLineTooltips.drawHoveringText( - posX, posY, tips, - stack, - currentRenderPassMousePosition?.first ?: Utils.getMouseX(), - currentRenderPassMousePosition?.second ?: Utils.getMouseY(), + posX = posX, + posY = posY, + tips = tipsRender, + stack = stack, + borderColor = color, + snapsToTopIfToLong = snapsToTopIfToLong, + mouseX = currentRenderPassMousePosition?.first ?: Utils.getMouseX(), + mouseY = currentRenderPassMousePosition?.second ?: Utils.getMouseY(), ) GlStateManager.popMatrix() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt index d6f888bad..bd582ea5d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt @@ -129,7 +129,7 @@ class SkyHanniItemTracker( } val lore = buildLore(data, itemProfit, hidden, newDrop, internalName) - val renderable = if (isInventoryOpen()) Renderable.clickAndHover(displayName, lore) { + val renderable = if (isInventoryOpen()) Renderable.clickAndHover(displayName, lore, onClick = { if (System.currentTimeMillis() > lastClickDelay + 150) { if (KeyboardManager.isModifierKeyDown()) { data.items.remove(internalName) @@ -143,7 +143,7 @@ class SkyHanniItemTracker( } update() } - } else Renderable.string(displayName) + }) else Renderable.string(displayName) lists.addAsSingletonList(renderable) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index 8f477ae59..565a84eff 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -122,12 +122,12 @@ open class SkyHanniTracker( "§ccurrent session of", "§c$name" ), - ) { - if (sessionResetTime.passedSince() > 3.seconds) { - reset(DisplayMode.SESSION, "Reset this session of $name!") - sessionResetTime = SimpleTimeMark.now() - } - } + onClick = { + if (sessionResetTime.passedSince() > 3.seconds) { + reset(DisplayMode.SESSION, "Reset this session of $name!") + sessionResetTime = SimpleTimeMark.now() + } + }) private fun buildDisplayModeView() = LorenzUtils.buildSelector( "§7Display Mode: ", -- cgit