diff options
-rw-r--r-- | build.gradle | 6 | ||||
-rw-r--r-- | data.json | 3 | ||||
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/Config.kt | 57 | ||||
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/ExternalConfiguration.kt | 5 | ||||
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt | 4 | ||||
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt | 2 |
6 files changed, 61 insertions, 16 deletions
diff --git a/build.gradle b/build.gradle index e521e3e..52d615d 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id "org.jetbrains.kotlin.jvm" version "1.5.31" } -version = "1.0.4" +version = "1.0.5" group = "tech.thatgravyboat" archivesBaseName = "RewardClaim" @@ -34,8 +34,8 @@ repositories { dependencies { //include 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21' - provided "gg.essential:loader-launchwrapper:1.1.1" - implementation "gg.essential:essential-1.8.9-forge:1457" + provided "gg.essential:loader-launchwrapper:1.1.2" + implementation "gg.essential:essential-1.8.9-forge:1582" } /** @@ -120,5 +120,6 @@ "missedRewardRegex": "We noticed you haven't claimed your free Daily Reward yet!\\nTo choose your reward you have to click the link to visit our website! As a reminder, here's your link for today: https://rewards\\.hypixel\\.net/claim-reward/(?<id>[A-Za-z0-9]{8})", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36", "disabled": false, - "disabledMessage": "Reward Claim was disabled by the mod author for an unknown reason." + "disabledMessage": "Reward Claim was disabled by the mod author for an unknown reason.", + "disabledMessage2": "Reward Claim was disabled by the mod author for an unknown reason." } diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/Config.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/Config.kt index 8cc2f6d..b2a784d 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/Config.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/Config.kt @@ -10,28 +10,73 @@ import java.net.URI @Suppress("unused") object Config : Vigilant(File("./config/rewardclaim.toml")) { - @Property(type = PropertyType.SWITCH, "Show Confirmation", "General", description = "Shows a confirmation before you claim an item to make sure you don't accidentally claim a reward you didn't want.") + @Property( + type = PropertyType.SWITCH, + name = "Show Confirmation", + category = "General", + description = "Shows a confirmation before you claim an item to make sure you don't accidentally claim a reward you didn't want." + ) var showConfirmation = true - @Property(type = PropertyType.SWITCH, "Show Double Click Confirmation", "General", description = "Shows a confirmation before you double click claim an item to make sure you don't accidentally claim a reward you didn't want.") + @Property( + type = PropertyType.SWITCH, + name = "Show Double Click Confirmation", + category = "General", + description = "Shows a confirmation before you double click claim an item to make sure you don't accidentally claim a reward you didn't want." + ) var showDoubleClickConfirmation = true - @Property(type = PropertyType.BUTTON, "Discord", "General", "Self Promotion", placeholder = "Visit") + @Property( + type = PropertyType.NUMBER, + name = "Checking timer", + category = "General", + description = "Determines how long it will take to check and ignore screen changes, if you are high ping you may want this higher.", + min = 1000, + max = 10000, + increment = 200 + ) + var checkingTimer = 3000 + + @Property( + type = PropertyType.BUTTON, + name = "Discord", + category = "General", + subcategory = "Self Promotion", + placeholder = "Visit" + ) fun discord() { UDesktop.browse(URI("https://discord.gg/jRhkYFmpCa")) } - @Property(type = PropertyType.BUTTON, "Twitter", "General", "Self Promotion", placeholder = "Visit") + @Property( + type = PropertyType.BUTTON, + name = "Twitter", + category = "General", + subcategory = "Self Promotion", + placeholder = "Visit" + ) fun twitter() { UDesktop.browse(URI("https://twitter.com/ThatGravyBoat")) } - @Property(type = PropertyType.BUTTON, "Github", "General", "Self Promotion", placeholder = "Visit") + @Property( + type = PropertyType.BUTTON, + name = "Github", + category = "General", + subcategory = "Self Promotion", + placeholder = "Visit" + ) fun github() { UDesktop.browse(URI("https://github.com/ThatGravyBoat/RewardClaim")) } - @Property(type = PropertyType.BUTTON, "YouTube", "General", "Self Promotion", placeholder = "Visit") + @Property( + type = PropertyType.BUTTON, + name = "YouTube", + category = "General", + subcategory = "Self Promotion", + placeholder = "Visit" + ) fun rickroll() { UDesktop.browse(URI("https://www.youtube.com/watch?v=dQw4w9WgXcQ")) } diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ExternalConfiguration.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ExternalConfiguration.kt index 55f5f4d..39e319f 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ExternalConfiguration.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ExternalConfiguration.kt @@ -29,7 +29,7 @@ object ExternalConfiguration { rewardMissedMessageRegex = Regex(config.missedRewardRegex) userAgent = config.userAgent disabled = config.disabled - disabledMessage = config.disabledMessage + disabledMessage = if (config.disabledMessage2.isNullOrBlank()) config.disabledMessage else config.disabledMessage2 } } @@ -40,6 +40,7 @@ object ExternalConfiguration { val missedRewardRegex: String = "We noticed you haven't claimed your free Daily Reward yet!\\nTo choose your reward you have to click the link to visit our website! As a reminder, here's your link for today: https://rewards\\.hypixel\\.net/claim-reward/(?<id>[A-Za-z0-9]{8})", val userAgent: String = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36", val disabled: Boolean = false, - val disabledMessage: String = "Reward Claim was disabled by the mod author for an unknown reason." + val disabledMessage: String = "Reward Claim was disabled by the mod author for an unknown reason.", + val disabledMessage2: String = "Reward Claim was disabled by the mod author for an unknown reason." ) } diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt index 3e15ec2..ba9b6d8 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/RewardClaim.kt @@ -73,11 +73,9 @@ object RewardClaim { println("-------------------------------------------------------------------------------") } if (EssentialAPI.getGuiUtil().openedScreen() is RewardClaimGui && - event.gui is GuiScreenBook && - System.currentTimeMillis() - rewardClaimTime <= 3000 + (event.gui is GuiScreenBook || event.gui == null) && System.currentTimeMillis() - rewardClaimTime <= Config.checkingTimer ) { event.isCanceled = true - rewardClaimTime = 0 } } } diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt index db04abe..1950acb 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt @@ -190,7 +190,7 @@ class RewardClaimGui(private val id: String) : WindowScreen() { } } else { state = State.FAILED_REWARDS - errorPopup("Regex could not be found.\nSecurity: ${securityMatcher != null}\nI18n: ${i18nMatcher != null}\nData: $${dataMatcher != null}") + errorPopup("Regex could not be found.\nUrl:${this.url}\nSecurity: ${securityMatcher != null}\nI18n: ${i18nMatcher != null}\nData: $${dataMatcher != null}") } } } |