Add per compat project event listeners
[no changelog]
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user