mirror of
https://github.com/ViaVersion/VIAaaS.git
synced 2025-01-23 21:52:35 +01:00
Fixed compression in 1.7 client
This commit is contained in:
parent
51aac3b302
commit
45edca679b
@ -10,7 +10,6 @@ import io.netty.handler.codec.*
|
||||
import io.netty.handler.flow.FlowControlHandler
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler
|
||||
import us.myles.ViaVersion.api.data.UserConnection
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolPipeline
|
||||
import us.myles.ViaVersion.api.type.Type
|
||||
import us.myles.ViaVersion.exception.CancelCodecException
|
||||
import us.myles.ViaVersion.exception.CancelDecoderException
|
||||
@ -24,7 +23,7 @@ import java.util.zip.Inflater
|
||||
object ChannelInit : ChannelInitializer<Channel>() {
|
||||
override fun initChannel(ch: Channel) {
|
||||
val user = UserConnection(ch)
|
||||
ProtocolPipeline(user).add(CloudHandlerProtocol())
|
||||
CloudPipeline(user)
|
||||
ch.pipeline().addLast("frame-encoder", FrameEncoder)
|
||||
.addLast("frame-decoder", FrameDecoder())
|
||||
.addLast("compress", CloudCompressor())
|
||||
|
@ -7,9 +7,8 @@ import io.netty.channel.socket.SocketChannel
|
||||
import io.netty.channel.socket.nio.NioSocketChannel
|
||||
import us.myles.ViaVersion.api.PacketWrapper
|
||||
import us.myles.ViaVersion.api.Via
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion
|
||||
import us.myles.ViaVersion.api.protocol.SimpleProtocol
|
||||
import us.myles.ViaVersion.api.data.UserConnection
|
||||
import us.myles.ViaVersion.api.protocol.*
|
||||
import us.myles.ViaVersion.api.remapper.PacketRemapper
|
||||
import us.myles.ViaVersion.api.type.Type
|
||||
import us.myles.ViaVersion.packets.State
|
||||
@ -17,7 +16,20 @@ import java.net.InetAddress
|
||||
import java.net.InetSocketAddress
|
||||
import java.util.logging.Logger
|
||||
|
||||
class CloudHandlerProtocol : SimpleProtocol() {
|
||||
class CloudPipeline(userConnection: UserConnection) : ProtocolPipeline(userConnection) {
|
||||
override fun registerPackets() {
|
||||
super.registerPackets()
|
||||
add(CloudHandlerProtocol)
|
||||
}
|
||||
|
||||
override fun add(protocol: Protocol<*, *, *, *>?) {
|
||||
super.add(protocol)
|
||||
pipes().remove(CloudHandlerProtocol)
|
||||
pipes().add(CloudHandlerProtocol) // needs to be the last
|
||||
}
|
||||
}
|
||||
|
||||
object CloudHandlerProtocol : SimpleProtocol() {
|
||||
val logger = Logger.getLogger("CloudHandlerProtocol")
|
||||
override fun registerPackets() {
|
||||
this.registerIncoming(State.HANDSHAKE, 0, 0, object : PacketRemapper() {
|
||||
|
@ -37,7 +37,7 @@ fun main() {
|
||||
loop@ while (true) {
|
||||
try {
|
||||
val cmd = readLine()?.trim()?.split(" ")
|
||||
when (cmd?.get(0)) {
|
||||
when (cmd?.get(0)?.toLowerCase()) {
|
||||
"stop", "end" -> break@loop
|
||||
"viaversion", "viaver" -> Via.getManager().commandHandler.onCommand(CloudConsoleSender, cmd.subList(1, cmd.size)
|
||||
.toTypedArray())
|
||||
|
Loading…
Reference in New Issue
Block a user