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. --- .../kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main/kotlin') 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