|
18 | 18 | package de.florianmichael.vialoadingbase.netty; |
19 | 19 |
|
20 | 20 | import com.viaversion.viaversion.api.connection.UserConnection; |
| 21 | +import de.florianmichael.vialoadingbase.netty.event.CompressionReorderEvent; |
21 | 22 | import de.florianmichael.vialoadingbase.netty.handler.VLBViaDecodeHandler; |
22 | 23 | import de.florianmichael.vialoadingbase.netty.handler.VLBViaEncodeHandler; |
23 | 24 | import io.netty.channel.ChannelHandler; |
@@ -46,18 +47,20 @@ public void handlerAdded(ChannelHandlerContext ctx) throws Exception { |
46 | 47 | public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { |
47 | 48 | super.userEventTriggered(ctx, evt); |
48 | 49 |
|
49 | | - final int decoderIndex = ctx.pipeline().names().indexOf(getDecompressionHandlerName()); |
50 | | - if (decoderIndex == -1) return; |
| 50 | + if (evt instanceof CompressionReorderEvent) { |
| 51 | + final int decoderIndex = ctx.pipeline().names().indexOf(getDecompressionHandlerName()); |
| 52 | + if (decoderIndex == -1) return; |
51 | 53 |
|
52 | | - if (decoderIndex > ctx.pipeline().names().indexOf(VIA_DECODER_HANDLER_NAME)) { |
53 | | - final ChannelHandler decoder = ctx.pipeline().get(VIA_DECODER_HANDLER_NAME); |
54 | | - final ChannelHandler encoder = ctx.pipeline().get(VIA_ENCODER_HANDLER_NAME); |
| 54 | + if (decoderIndex > ctx.pipeline().names().indexOf(VIA_DECODER_HANDLER_NAME)) { |
| 55 | + final ChannelHandler decoder = ctx.pipeline().get(VIA_DECODER_HANDLER_NAME); |
| 56 | + final ChannelHandler encoder = ctx.pipeline().get(VIA_ENCODER_HANDLER_NAME); |
55 | 57 |
|
56 | | - ctx.pipeline().remove(decoder); |
57 | | - ctx.pipeline().remove(encoder); |
| 58 | + ctx.pipeline().remove(decoder); |
| 59 | + ctx.pipeline().remove(encoder); |
58 | 60 |
|
59 | | - ctx.pipeline().addAfter(getDecompressionHandlerName(), VIA_DECODER_HANDLER_NAME, decoder); |
60 | | - ctx.pipeline().addAfter(getCompressionHandlerName(), VIA_ENCODER_HANDLER_NAME, encoder); |
| 61 | + ctx.pipeline().addAfter(getDecompressionHandlerName(), VIA_DECODER_HANDLER_NAME, decoder); |
| 62 | + ctx.pipeline().addAfter(getCompressionHandlerName(), VIA_ENCODER_HANDLER_NAME, encoder); |
| 63 | + } |
61 | 64 | } |
62 | 65 | } |
63 | 66 |
|
|
0 commit comments