|
24 | 24 | import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
25 | 25 | import com.velocitypowered.proxy.protocol.StateRegistry;
|
26 | 26 | import com.velocitypowered.proxy.protocol.netty.MinecraftDecoder;
|
| 27 | +import com.velocitypowered.proxy.protocol.netty.MinecraftVarintFrameDecoder; |
27 | 28 | import com.velocitypowered.proxy.protocol.packet.HandshakePacket;
|
28 | 29 | import com.velocitypowered.proxy.protocol.packet.LegacyHandshakePacket;
|
29 | 30 | import com.velocitypowered.proxy.protocol.packet.LegacyPingPacket;
|
|
34 | 35 | import io.netty.buffer.Unpooled;
|
35 | 36 | import io.netty.channel.Channel;
|
36 | 37 | import io.netty.channel.ChannelOutboundBuffer;
|
| 38 | +import io.netty.channel.ChannelPipeline; |
37 | 39 | import java.net.InetSocketAddress;
|
38 | 40 | import net.elytrium.fastmotd.FastMOTD;
|
39 | 41 | import net.elytrium.fastmotd.Settings;
|
@@ -143,8 +145,14 @@ public boolean handle(HandshakePacket handshake) {
|
143 | 145 |
|
144 | 146 | this.protocolVersion = handshake.getProtocolVersion();
|
145 | 147 | this.serverAddress = cleanHost(handshake.getServerAddress()) + ":" + handshake.getPort();
|
146 |
| - this.channel.pipeline().remove(Connections.FRAME_ENCODER); |
147 |
| - this.channel.pipeline().get(MinecraftDecoder.class).setState(StateRegistry.STATUS); |
| 148 | + |
| 149 | + ChannelPipeline pipeline = this.channel.pipeline(); |
| 150 | + pipeline.remove(Connections.FRAME_ENCODER); |
| 151 | + pipeline.get(MinecraftDecoder.class).setState(StateRegistry.STATUS); |
| 152 | + MinecraftVarintFrameDecoder frameDecoder = pipeline.get(MinecraftVarintFrameDecoder.class); |
| 153 | + if (frameDecoder != null) { |
| 154 | + frameDecoder.setState(StateRegistry.STATUS); |
| 155 | + } |
148 | 156 |
|
149 | 157 | if (Settings.IMP.MAIN.LOG_PINGS) {
|
150 | 158 | this.plugin.getLogger().info("{} is pinging the server with version {}", this.connection.getRemoteAddress(), this.protocolVersion);
|
|
0 commit comments