mirror of
https://github.com/ayunami2000/ayunViaProxyEagUtils.git
synced 2024-11-22 04:16:04 -08:00
fix
This commit is contained in:
parent
0f2425f4fa
commit
1dc04f3927
|
@ -50,42 +50,44 @@ public class EaglercraftInitialHandler extends ByteToMessageDecoder {
|
||||||
ctx.pipeline().addBefore("eaglercraft-initial-handler", "ws-handler", new WebSocketServerProtocolHandler("/", null, true));
|
ctx.pipeline().addBefore("eaglercraft-initial-handler", "ws-handler", new WebSocketServerProtocolHandler("/", null, true));
|
||||||
ctx.pipeline().addBefore("eaglercraft-initial-handler", "ws-active-notifier", new WebSocketActiveNotifier());
|
ctx.pipeline().addBefore("eaglercraft-initial-handler", "ws-active-notifier", new WebSocketActiveNotifier());
|
||||||
ctx.pipeline().addBefore("eaglercraft-initial-handler", "eaglercraft-handler", new EaglercraftHandler());
|
ctx.pipeline().addBefore("eaglercraft-initial-handler", "eaglercraft-handler", new EaglercraftHandler());
|
||||||
ctx.pipeline().replace(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME, new LegacyPassthroughInitialHandler() {
|
if (ctx.pipeline().get(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME) != null) {
|
||||||
@Override
|
ctx.pipeline().replace(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME, new LegacyPassthroughInitialHandler() {
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
|
@Override
|
||||||
if (ctx.channel().isOpen()) {
|
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
|
||||||
if (msg.isReadable()) {
|
if (ctx.channel().isOpen()) {
|
||||||
int lengthOrPacketId = msg.getUnsignedByte(0);
|
if (msg.isReadable()) {
|
||||||
if (lengthOrPacketId == 0 || lengthOrPacketId == 1 || lengthOrPacketId == 2 || lengthOrPacketId == 254) {
|
int lengthOrPacketId = msg.getUnsignedByte(0);
|
||||||
boolean fard = false;
|
if (lengthOrPacketId == 0 || lengthOrPacketId == 1 || lengthOrPacketId == 2 || lengthOrPacketId == 254) {
|
||||||
for (Map.Entry<String, ChannelHandler> entry : ctx.pipeline()) {
|
boolean fard = false;
|
||||||
if (entry.getKey().equals(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME)) {
|
for (Map.Entry<String, ChannelHandler> entry : ctx.pipeline()) {
|
||||||
fard = true;
|
if (entry.getKey().equals(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME)) {
|
||||||
} else {
|
fard = true;
|
||||||
if (fard) {
|
} else {
|
||||||
ctx.pipeline().remove(entry.getValue());
|
if (fard) {
|
||||||
|
ctx.pipeline().remove(entry.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Supplier<ChannelHandler> handlerSupplier = () -> PluginManager.EVENT_MANAGER.call(new Client2ProxyHandlerCreationEvent(new PassthroughClient2ProxyHandler(), true)).getHandler();
|
Supplier<ChannelHandler> handlerSupplier = () -> PluginManager.EVENT_MANAGER.call(new Client2ProxyHandlerCreationEvent(new PassthroughClient2ProxyHandler(), true)).getHandler();
|
||||||
PassthroughClient2ProxyChannelInitializer channelInitializer = new PassthroughClient2ProxyChannelInitializer(handlerSupplier);
|
PassthroughClient2ProxyChannelInitializer channelInitializer = new PassthroughClient2ProxyChannelInitializer(handlerSupplier);
|
||||||
try {
|
try {
|
||||||
initChannelMethod.invoke(channelInitializer, ctx.channel());
|
initChannelMethod.invoke(channelInitializer, ctx.channel());
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
ctx.fireChannelActive();
|
||||||
|
ctx.fireChannelRead(msg.retain());
|
||||||
|
ctx.pipeline().remove(this);
|
||||||
|
} else {
|
||||||
|
ctx.pipeline().remove(this);
|
||||||
|
ctx.pipeline().fireChannelRead(msg.retain());
|
||||||
}
|
}
|
||||||
ctx.fireChannelActive();
|
|
||||||
ctx.fireChannelRead(msg.retain());
|
|
||||||
ctx.pipeline().remove(this);
|
|
||||||
} else {
|
|
||||||
ctx.pipeline().remove(this);
|
|
||||||
ctx.pipeline().fireChannelRead(msg.retain());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
ctx.fireUserEventTriggered(EaglercraftClientConnected.INSTANCE);
|
ctx.fireUserEventTriggered(EaglercraftClientConnected.INSTANCE);
|
||||||
ctx.pipeline().fireChannelRead(in.readBytes(in.readableBytes()));
|
ctx.pipeline().fireChannelRead(in.readBytes(in.readableBytes()));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user