From db67c301c7dda69dda9665ed1194ba9d04fb487d Mon Sep 17 00:00:00 2001 From: ThatGravyBoat Date: Fri, 1 Oct 2021 06:01:48 -0230 Subject: Fixed a bug where if the data wasn't loaded the store link would cause an error. --- build.gradle | 2 +- .../kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 0b88a5d..b23f830 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id "org.jetbrains.kotlin.jvm" version "1.5.31" } -version = "1.0.2" +version = "1.0.3" group = "tech.thatgravyboat" archivesBaseName = "RewardClaim" diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt index ad22f8c..ce47c4c 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt @@ -292,7 +292,7 @@ class RewardClaimGui(private val id: String) : WindowScreen() { "Reward Claim AD", "Hypixel is a great server and as such we don't want to remove their ad for their store. You can click the skip button when it appears to remove this message and claim your reward.", UIImage.ofResourceCached("/rewardclaim/external_link.png"), - { UDesktop.browse(URI(data.adLink)) }, + { UDesktop.browse(getAd()) }, "${ChatColor.BOLD}Store", null, { removePopup() }, @@ -303,13 +303,17 @@ class RewardClaimGui(private val id: String) : WindowScreen() { "Reward Claim AD", "Hypixel is a great server and as such we don't want to remove their ad for their store. You can click the skip button when it appears to remove this message and claim your reward.", UIImage.ofResourceCached("/rewardclaim/external_link.png"), - { UDesktop.browse(URI(data.adLink)) }, + { UDesktop.browse(getAd()) }, "${ChatColor.BOLD}Store" ) childOf this.window } } } + private fun getAd() : URI { + return if (this::data.isInitialized) URI(data.adLink) else URI("https://store.hypixel.net/?utm_source=rewards-video&utm_medium=website&utm_content=TRsCiBNYY7M&utm_campaign=Rewardss") + } + override fun onDrawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) { this.window.draw() } -- cgit