diff options
author | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-10-01 06:01:48 -0230 |
---|---|---|
committer | ThatGravyBoat <thatgravyboat@gmail.com> | 2021-10-01 06:01:48 -0230 |
commit | db67c301c7dda69dda9665ed1194ba9d04fb487d (patch) | |
tree | 128b1110f508b1db3dbd4743bcf911600439161c /src | |
parent | 68366924a0d27f938a95accda5618eef970cbcc1 (diff) | |
download | RewardClaim-db67c301c7dda69dda9665ed1194ba9d04fb487d.tar.gz RewardClaim-db67c301c7dda69dda9665ed1194ba9d04fb487d.tar.bz2 RewardClaim-db67c301c7dda69dda9665ed1194ba9d04fb487d.zip |
Fixed a bug where if the data wasn't loaded the store link would cause an error.v1.0.3
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt | 8 |
1 files changed, 6 insertions, 2 deletions
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() } |