From 412bcde727bb9fe6dde4b591484a0a290dac6b49 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Thu, 12 Jan 2023 22:21:28 +0100 Subject: [PATCH] Fixed proxy online mode not being toggleable at runtime --- .../viaproxy/proxy/client2proxy/Client2ProxyHandler.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java b/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java index f1206d6..58cf59b 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/Client2ProxyHandler.java @@ -70,11 +70,7 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler { private static final Random RANDOM = new Random(); static { - if (Options.ONLINE_MODE) { - KEY_PAIR = CryptUtil.generateKeyPair(); - } else { - KEY_PAIR = null; - } + KEY_PAIR = CryptUtil.generateKeyPair(); } private ProxyConnection proxyConnection; @@ -88,7 +84,7 @@ public class Client2ProxyHandler extends SimpleChannelInboundHandler { public void channelActive(ChannelHandlerContext ctx) throws Exception { super.channelActive(ctx); - if (Options.ONLINE_MODE) RANDOM.nextBytes(this.verifyToken); + RANDOM.nextBytes(this.verifyToken); this.proxyConnection = new ProxyConnection(Proxy2ServerHandler::new, Proxy2ServerChannelInitializer::new, (SocketChannel) ctx.channel()); ctx.channel().attr(ProxyConnection.PROXY_CONNECTION_ATTRIBUTE_KEY).set(this.proxyConnection);