From 5ed74f2df49c93ed1617520a935078b59ad7e195 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 1 Sep 2024 22:21:19 +0200 Subject: Add per compat project event listeners [no changelog] --- src/main/kotlin/util/SBData.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/kotlin/util/SBData.kt') 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 { -- cgit