Skip to content

Commit 5761ac3

Browse files
committed
fixes and stuff and things
1 parent a923d84 commit 5761ac3

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

src/main/java/me/ayunami2000/ayunViaProxyEagUtils/EaglerServerHandler.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import io.netty.buffer.ByteBuf;
66
import io.netty.buffer.ByteBufUtil;
77
import io.netty.buffer.Unpooled;
8-
import io.netty.channel.*;
8+
import io.netty.channel.ChannelHandlerContext;
99
import io.netty.handler.codec.MessageToMessageCodec;
10-
import io.netty.handler.codec.http.websocketx.*;
10+
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
1111
import net.raphimc.netminecraft.constants.MCPackets;
1212
import net.raphimc.netminecraft.netty.connection.NetClient;
1313
import net.raphimc.netminecraft.packet.PacketTypes;
@@ -20,7 +20,9 @@
2020
import net.raphimc.viaproxy.proxy.util.ExceptionUtil;
2121

2222
import java.nio.charset.StandardCharsets;
23-
import java.util.*;
23+
import java.util.ArrayList;
24+
import java.util.List;
25+
import java.util.UUID;
2426

2527
public class EaglerServerHandler extends MessageToMessageCodec<BinaryWebSocketFrame, ByteBuf> {
2628
private final VersionEnum version;
@@ -231,6 +233,7 @@ public void decodeOld(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
231233
return;
232234
}
233235
// TODO: FIX LOL!!
236+
// also todo: handle status packets
234237
byte[] res = new byte[msg.length > 16384 ? 16384 : 8192];
235238
System.arraycopy(msg, 1, res, 0, res.length);
236239
if (res.length < 16384) {

src/main/java/me/ayunami2000/ayunViaProxyEagUtils/EaglerSkinHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
import io.netty.channel.ChannelInboundHandlerAdapter;
88
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
99
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
10-
import net.raphimc.vialoader.util.VersionEnum;
1110
import net.raphimc.viaproxy.ViaProxy;
12-
import net.raphimc.viaproxy.cli.options.Options;
1311
import net.raphimc.viaproxy.proxy.util.ExceptionUtil;
1412

1513
import javax.imageio.ImageIO;

src/main/java/me/ayunami2000/ayunViaProxyEagUtils/EaglercraftInitialHandler.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
6363
for (Map.Entry<String, ChannelHandler> entry : ctx.pipeline()) {
6464
if (entry.getKey().equals(Client2ProxyChannelInitializer.LEGACY_PASSTHROUGH_INITIAL_HANDLER_NAME)) {
6565
fard = true;
66-
}
67-
if (fard) {
68-
ctx.pipeline().remove(entry.getValue());
66+
} else {
67+
if (fard) {
68+
ctx.pipeline().remove(entry.getValue());
69+
}
6970
}
7071
}
7172

@@ -76,11 +77,9 @@ protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
7677
} catch (IllegalAccessException | InvocationTargetException e) {
7778
throw new RuntimeException(e);
7879
}
79-
try {
80-
((ChannelInboundHandler) ctx.pipeline().get(MCPipeline.HANDLER_HANDLER_NAME)).channelRead(ctx, msg.retain());
81-
} catch (Exception e) {
82-
throw new RuntimeException(e);
83-
}
80+
ctx.fireChannelActive();
81+
ctx.fireChannelRead(msg.retain());
82+
ctx.pipeline().remove(this);
8483
} else {
8584
ctx.pipeline().remove(this);
8685
ctx.pipeline().fireChannelRead(msg.retain());

src/main/java/me/ayunami2000/ayunViaProxyEagUtils/Main.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package me.ayunami2000.ayunViaProxyEagUtils;
22

33
import io.netty.buffer.ByteBuf;
4-
import io.netty.channel.*;
4+
import io.netty.channel.Channel;
5+
import io.netty.channel.ChannelHandlerContext;
6+
import io.netty.channel.ChannelInboundHandlerAdapter;
57
import io.netty.handler.codec.http.*;
6-
import io.netty.handler.codec.http.websocketx.*;
8+
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
9+
import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
10+
import io.netty.handler.codec.http.websocketx.WebSocketClientProtocolHandler;
11+
import io.netty.handler.codec.http.websocketx.WebSocketVersion;
712
import io.netty.handler.codec.http.websocketx.extensions.compression.WebSocketClientCompressionHandler;
813
import io.netty.handler.ssl.SslHandler;
914
import io.netty.util.AttributeKey;
@@ -20,7 +25,6 @@
2025
import net.raphimc.viaproxy.plugins.events.types.ITyped;
2126
import net.raphimc.viaproxy.proxy.session.LegacyProxyConnection;
2227
import net.raphimc.viaproxy.proxy.session.ProxyConnection;
23-
import net.raphimc.viaproxy.proxy.util.ChannelUtil;
2428
import net.raphimc.viaproxy.proxy.util.ExceptionUtil;
2529

2630
import javax.net.ssl.*;
@@ -91,7 +95,7 @@ public void onEvent(final Proxy2ServerChannelInitializeEvent event) throws URISy
9195

9296

9397

94-
c2p.attr(secureWs).set(true);
98+
// c2p.attr(secureWs).set(true);
9599

96100

97101

src/main/java/me/ayunami2000/ayunViaProxyEagUtils/MsgPromise.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package me.ayunami2000.ayunViaProxyEagUtils;
22

3-
import io.netty.channel.ChannelHandlerContext;
43
import io.netty.channel.ChannelPromise;
54

65
public class MsgPromise {

src/main/java/me/ayunami2000/ayunViaProxyEagUtils/SkinPackets.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package me.ayunami2000.ayunViaProxyEagUtils;
22

33
import io.netty.channel.ChannelHandlerContext;
4-
import net.raphimc.viaproxy.cli.options.Options;
54

65
import java.io.IOException;
76
import java.net.MalformedURLException;

0 commit comments

Comments
 (0)