Skip to content

Commit

Permalink
Update to fix Hypixel change
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGravyBoat committed Apr 22, 2022
1 parent 502915c commit a3f64c9
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 16 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
}

/**
Expand Down
3 changes: 2 additions & 1 deletion data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
57 changes: 51 additions & 6 deletions src/main/kotlin/tech/thatgravyboat/rewardclaim/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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."
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
}
}
Expand Down

0 comments on commit a3f64c9

Please sign in to comment.