aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-09-06 20:18:28 +0200
committerLinnea Gräf <nea@nea.moe>2024-09-06 20:18:28 +0200
commit4c4c63943405f35af94f8f373fe61fbece2c80d4 (patch)
treedd4e8771506fab5cf3255a1b1a77a59ccd46ba1d /src
parent2d936ea4a2b32c3900fcbfe6c891fef6d874cb1c (diff)
downloadfirmament-4c4c63943405f35af94f8f373fe61fbece2c80d4.tar.gz
firmament-4c4c63943405f35af94f8f373fe61fbece2c80d4.tar.bz2
firmament-4c4c63943405f35af94f8f373fe61fbece2c80d4.zip
Send profile id even more rarely
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/util/SBData.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/kotlin/util/SBData.kt b/src/main/kotlin/util/SBData.kt
index 5af8548..353bb06 100644
--- a/src/main/kotlin/util/SBData.kt
+++ b/src/main/kotlin/util/SBData.kt
@@ -24,7 +24,7 @@ object SBData {
val skyblockLocation: SkyBlockIsland? get() = locraw?.skyblockLocation
val hasValidLocraw get() = locraw?.server !in listOf("limbo", null)
val isOnSkyblock get() = locraw?.gametype == "SKYBLOCK"
- var lastProfileIdRequest = TimeMark.farPast()
+ var profileIdCommandDebounce = TimeMark.farPast()
fun init() {
ServerConnectedEvent.subscribe("SBData:onServerConnected") {
HypixelModAPI.getInstance().subscribeToEventPacket(ClientboundLocationPacket::class.java)
@@ -37,16 +37,17 @@ object SBData {
it.mode.getOrNull(),
it.map.getOrNull())
SkyblockServerUpdateEvent.publish(SkyblockServerUpdateEvent(lastLocraw, null))
+ profileIdCommandDebounce = TimeMark.now()
}
}
SkyblockServerUpdateEvent.subscribe("SBData:sendProfileId") {
- if (!hasReceivedProfile && isOnSkyblock && lastProfileIdRequest.passedTime() > 30.seconds) {
- lastProfileIdRequest = TimeMark.now()
+ if (!hasReceivedProfile && isOnSkyblock && profileIdCommandDebounce.passedTime() > 10.seconds) {
+ profileIdCommandDebounce = TimeMark.now()
MC.sendServerCommand("profileid")
}
}
AllowChatEvent.subscribe("SBData:hideProfileSuggest") { event ->
- if (event.unformattedString in profileSuggestTexts && lastProfileIdRequest.passedTime() < 5.seconds) {
+ if (event.unformattedString in profileSuggestTexts && profileIdCommandDebounce.passedTime() < 5.seconds) {
event.cancel()
}
}