9
0
mirror of https://github.com/Auxilor/EcoSkills.git synced 2025-12-31 04:46:31 +00:00

Fixed packet bug for some users

This commit is contained in:
Auxilor
2023-05-19 10:47:34 +01:00
parent 6a66aea2e4
commit a11b97bcef
3 changed files with 21 additions and 3 deletions

View File

@@ -7,12 +7,18 @@ import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket
class ActionBarCompatibility : ActionBarCompatibilityProxy {
private val ClientboundSystemChatPacket.isActionBar: Boolean
get() = this::class.java.declaredFields
.first { it.type == Boolean::class.java }
.apply { isAccessible = true }
.get(this) as Boolean
override fun onSend(event: PacketEvent) {
val player = event.player
when (val packet = event.packet.handle) {
is ClientboundSetActionBarTextPacket -> player.pausePersistentActionBar()
is ClientboundSystemChatPacket -> if (packet.c()) player.pausePersistentActionBar()
is ClientboundSystemChatPacket -> if (packet.isActionBar) player.pausePersistentActionBar()
}
}
}

View File

@@ -7,12 +7,18 @@ import com.willfp.ecoskills.actionbar.pausePersistentActionBar
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket
class ActionBarCompatibility : ActionBarCompatibilityProxy {
private val ClientboundSystemChatPacket.isActionBar: Boolean
get() = this::class.java.declaredFields
.first { it.type == Boolean::class.java }
.apply { isAccessible = true }
.get(this) as Boolean
override fun onSend(event: PacketEvent) {
val player = event.player
when (val packet = event.packet.handle) {
is ClientboundSetActionBarTextPacket -> player.pausePersistentActionBar()
is ClientboundSystemChatPacket -> if (packet.c()) player.pausePersistentActionBar()
is ClientboundSystemChatPacket -> if (packet.isActionBar) player.pausePersistentActionBar()
}
}
}

View File

@@ -7,12 +7,18 @@ import com.willfp.ecoskills.actionbar.pausePersistentActionBar
import net.minecraft.network.protocol.game.ClientboundSystemChatPacket
class ActionBarCompatibility : ActionBarCompatibilityProxy {
private val ClientboundSystemChatPacket.isActionBar: Boolean
get() = this::class.java.declaredFields
.first { it.type == Boolean::class.java }
.apply { isAccessible = true }
.get(this) as Boolean
override fun onSend(event: PacketEvent) {
val player = event.player
when (val packet = event.packet.handle) {
is ClientboundSetActionBarTextPacket -> player.pausePersistentActionBar()
is ClientboundSystemChatPacket -> if (packet.c()) player.pausePersistentActionBar()
is ClientboundSystemChatPacket -> if (packet.isActionBar) player.pausePersistentActionBar()
}
}
}