mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-09 10:01:52 +01:00
Fixed legacy ping passthrough not working when eaglercraft support is enabled
This commit is contained in:
parent
981a80d258
commit
f66bc3c435
@ -55,12 +55,12 @@ public class Client2ProxyChannelInitializer extends MinecraftChannelInitializer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.LEGACY_CLIENT_PASSTHROUGH) {
|
|
||||||
channel.pipeline().addLast(LEGACY_PASSTHROUGH_HANDLER_NAME, new LegacyClientPassthroughHandler());
|
|
||||||
}
|
|
||||||
if (Options.ALLOW_EAGLERCRAFT_CLIENTS) {
|
if (Options.ALLOW_EAGLERCRAFT_CLIENTS) {
|
||||||
channel.pipeline().addLast(EAGLERCRAFT_INITIAL_HANDLER_NAME, new EaglercraftInitialHandler());
|
channel.pipeline().addLast(EAGLERCRAFT_INITIAL_HANDLER_NAME, new EaglercraftInitialHandler());
|
||||||
}
|
}
|
||||||
|
if (Options.LEGACY_CLIENT_PASSTHROUGH) {
|
||||||
|
channel.pipeline().addLast(LEGACY_PASSTHROUGH_HANDLER_NAME, new LegacyClientPassthroughHandler());
|
||||||
|
}
|
||||||
|
|
||||||
super.initChannel(channel);
|
super.initChannel(channel);
|
||||||
channel.attr(MCPipeline.PACKET_REGISTRY_ATTRIBUTE_KEY).set(PacketRegistryUtil.getHandshakeRegistry(false));
|
channel.attr(MCPipeline.PACKET_REGISTRY_ATTRIBUTE_KEY).set(PacketRegistryUtil.getHandshakeRegistry(false));
|
||||||
|
@ -52,11 +52,8 @@ public class EaglercraftInitialHandler extends ByteToMessageDecoder {
|
|||||||
if (!ctx.channel().isOpen()) return;
|
if (!ctx.channel().isOpen()) return;
|
||||||
if (!in.isReadable()) return;
|
if (!in.isReadable()) return;
|
||||||
|
|
||||||
if (in.readableBytes() >= 3) {
|
if (in.readableBytes() >= 3 || in.getByte(0) != 'G') {
|
||||||
final byte[] data = new byte[3];
|
if (in.readableBytes() >= 3 && in.getCharSequence(0, 3, StandardCharsets.UTF_8).equals("GET")) { // Websocket request
|
||||||
in.getBytes(0, data);
|
|
||||||
final String method = new String(data, StandardCharsets.UTF_8);
|
|
||||||
if (method.equals("GET")) { // Websocket request
|
|
||||||
if (sslContext != null) {
|
if (sslContext != null) {
|
||||||
ctx.pipeline().addBefore(Client2ProxyChannelInitializer.EAGLERCRAFT_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.WEBSOCKET_SSL_HANDLER_NAME, sslContext.newHandler(ctx.alloc()));
|
ctx.pipeline().addBefore(Client2ProxyChannelInitializer.EAGLERCRAFT_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.WEBSOCKET_SSL_HANDLER_NAME, sslContext.newHandler(ctx.alloc()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user