diff options
author | Linnea Gräf <nea@nea.moe> | 2024-09-01 22:21:19 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-09-01 22:21:19 +0200 |
commit | 5ed74f2df49c93ed1617520a935078b59ad7e195 (patch) | |
tree | f0d52699fff7f820bd724902878988859bd43516 /src/main/kotlin/util | |
parent | 816f80f862d2f5de6bc9b0ae84cd6df0da341228 (diff) | |
download | Firmament-5ed74f2df49c93ed1617520a935078b59ad7e195.tar.gz Firmament-5ed74f2df49c93ed1617520a935078b59ad7e195.tar.bz2 Firmament-5ed74f2df49c93ed1617520a935078b59ad7e195.zip |
Add per compat project event listeners
[no changelog]
Diffstat (limited to 'src/main/kotlin/util')
-rw-r--r-- | src/main/kotlin/util/MC.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/util/SBData.kt | 8 | ||||
-rw-r--r-- | src/main/kotlin/util/WarpUtil.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/util/async/input.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/util/data/IDataHolder.kt | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/main/kotlin/util/MC.kt b/src/main/kotlin/util/MC.kt index b0d3056..db8eccb 100644 --- a/src/main/kotlin/util/MC.kt +++ b/src/main/kotlin/util/MC.kt @@ -19,7 +19,7 @@ object MC { private val messageQueue = ConcurrentLinkedQueue<Text>() init { - TickEvent.subscribe { + TickEvent.subscribe("MC:push") { while (true) { inGameHud.chatHud.addMessage(messageQueue.poll() ?: break) } diff --git a/src/main/kotlin/util/SBData.kt b/src/main/kotlin/util/SBData.kt index b30c6fb..5af8548 100644 --- a/src/main/kotlin/util/SBData.kt +++ b/src/main/kotlin/util/SBData.kt @@ -26,7 +26,7 @@ object SBData { val isOnSkyblock get() = locraw?.gametype == "SKYBLOCK" var lastProfileIdRequest = TimeMark.farPast() fun init() { - ServerConnectedEvent.subscribe { + ServerConnectedEvent.subscribe("SBData:onServerConnected") { HypixelModAPI.getInstance().subscribeToEventPacket(ClientboundLocationPacket::class.java) } HypixelModAPI.getInstance().createHandler(ClientboundLocationPacket::class.java) { @@ -39,18 +39,18 @@ object SBData { SkyblockServerUpdateEvent.publish(SkyblockServerUpdateEvent(lastLocraw, null)) } } - SkyblockServerUpdateEvent.subscribe { + SkyblockServerUpdateEvent.subscribe("SBData:sendProfileId") { if (!hasReceivedProfile && isOnSkyblock && lastProfileIdRequest.passedTime() > 30.seconds) { lastProfileIdRequest = TimeMark.now() MC.sendServerCommand("profileid") } } - AllowChatEvent.subscribe { event -> + AllowChatEvent.subscribe("SBData:hideProfileSuggest") { event -> if (event.unformattedString in profileSuggestTexts && lastProfileIdRequest.passedTime() < 5.seconds) { event.cancel() } } - ProcessChatEvent.subscribe(receivesCancelled = true) { event -> + ProcessChatEvent.subscribe(receivesCancelled = true, "SBData:loadProfile") { event -> val profileMatch = profileRegex.matchEntire(event.unformattedString) if (profileMatch != null) { try { diff --git a/src/main/kotlin/util/WarpUtil.kt b/src/main/kotlin/util/WarpUtil.kt index 8fca6f3..e37f56f 100644 --- a/src/main/kotlin/util/WarpUtil.kt +++ b/src/main/kotlin/util/WarpUtil.kt @@ -57,7 +57,7 @@ object WarpUtil { } init { - ProcessChatEvent.subscribe { + ProcessChatEvent.subscribe("WarpUtil:processChat") { if (it.unformattedString == "You haven't unlocked this fast travel destination!" && lastWarpAttempt.passedTime() < 2.seconds ) { diff --git a/src/main/kotlin/util/async/input.kt b/src/main/kotlin/util/async/input.kt index 9aab5cf..f22c595 100644 --- a/src/main/kotlin/util/async/input.kt +++ b/src/main/kotlin/util/async/input.kt @@ -24,7 +24,7 @@ private object InputHandler { } init { - HandledScreenKeyPressedEvent.subscribe { event -> + HandledScreenKeyPressedEvent.subscribe("Input:resumeAfterInput") { event -> synchronized(InputHandler) { val toRemove = activeContinuations.filter { event.matches(it.keybind) diff --git a/src/main/kotlin/util/data/IDataHolder.kt b/src/main/kotlin/util/data/IDataHolder.kt index 5d09bcd..cc97b58 100644 --- a/src/main/kotlin/util/data/IDataHolder.kt +++ b/src/main/kotlin/util/data/IDataHolder.kt @@ -56,7 +56,7 @@ interface IDataHolder<T> { } fun registerEvents() { - ScreenChangeEvent.subscribe { event -> + ScreenChangeEvent.subscribe("IDataHolder:saveOnScreenChange") { event -> performSaves() val p = MinecraftClient.getInstance().player if (p != null) { |