fixes and stuff and things

This commit is contained in:
ayunami2000 2023-10-03 19:42:20 -04:00
parent a923d84bd9
commit 5761ac3fb6
6 changed files with 21 additions and 19 deletions

View File

@ -5,9 +5,9 @@ import com.viaversion.viaversion.util.ChatColorUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.channel.*;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec;
import io.netty.handler.codec.http.websocketx.*;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import net.raphimc.netminecraft.constants.MCPackets;
import net.raphimc.netminecraft.netty.connection.NetClient;
import net.raphimc.netminecraft.packet.PacketTypes;
@ -20,7 +20,9 @@ import net.raphimc.viaproxy.proxy.session.ProxyConnection;
import net.raphimc.viaproxy.proxy.util.ExceptionUtil;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class EaglerServerHandler extends MessageToMessageCodec<BinaryWebSocketFrame, ByteBuf> {
private final VersionEnum version;
@ -231,6 +233,7 @@ public class EaglerServerHandler extends MessageToMessageCodec<BinaryWebSocketFr
return;
}
// TODO: FIX LOL!!
// also todo: handle status packets
byte[] res = new byte[msg.length > 16384 ? 16384 : 8192];
System.arraycopy(msg, 1, res, 0, res.length);
if (res.length < 16384) {

View File

@ -7,9 +7,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
import net.raphimc.vialoader.util.VersionEnum;
import net.raphimc.viaproxy.ViaProxy;
import net.raphimc.viaproxy.cli.options.Options;
import net.raphimc.viaproxy.proxy.util.ExceptionUtil;
import javax.imageio.ImageIO;

View File

@ -63,9 +63,10 @@ public class EaglercraftInitialHandler extends ByteToMessageDecoder {
for (Map.Entry<String, ChannelHandler> entry : ctx.pipeline()) {
if (entry.getKey().equals(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME)) {
fard = true;
}
if (fard) {
ctx.pipeline().remove(entry.getValue());
} else {
if (fard) {
ctx.pipeline().remove(entry.getValue());
}
}
}
@ -76,11 +77,9 @@ public class EaglercraftInitialHandler extends ByteToMessageDecoder {
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
try {
((ChannelInboundHandler) ctx.pipeline().get(MCPipeline.HANDLER_HANDLER_NAME)).channelRead(ctx, msg.retain());
} catch (Exception 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());

View File

@ -1,9 +1,14 @@
package me.ayunami2000.ayunViaProxyEagUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.*;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.http.*;
import io.netty.handler.codec.http.websocketx.*;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
import io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler;
import io.netty.handler.codec.http.websocketx.WebSocketVersion;
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketClientCompressionHandler;
import io.netty.handler.ssl.SslHandler;
import io.netty.util.AttributeKey;
@ -20,7 +25,6 @@ import net.raphimc.viaproxy.plugins.events.Proxy2ServerChannelInitializeEvent;
import net.raphimc.viaproxy.plugins.events.types.ITyped;
import net.raphimc.viaproxy.proxy.session.LegacyProxyConnection;
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
import net.raphimc.viaproxy.proxy.util.ChannelUtil;
import net.raphimc.viaproxy.proxy.util.ExceptionUtil;
import javax.net.ssl.*;
@ -91,7 +95,7 @@ public class Main extends ViaProxyPlugin {
c2p.attr(secureWs).set(true);
// c2p.attr(secureWs).set(true);

View File

@ -1,6 +1,5 @@
package me.ayunami2000.ayunViaProxyEagUtils;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
public class MsgPromise {

View File

@ -1,7 +1,6 @@
package me.ayunami2000.ayunViaProxyEagUtils;
import io.netty.channel.ChannelHandlerContext;
import net.raphimc.viaproxy.cli.options.Options;
import java.io.IOException;
import java.net.MalformedURLException;