diff --git a/src/main/java/net/raphimc/viaproxy/cli/options/Options.java b/src/main/java/net/raphimc/viaproxy/cli/options/Options.java index 44bf467..0ebf724 100644 --- a/src/main/java/net/raphimc/viaproxy/cli/options/Options.java +++ b/src/main/java/net/raphimc/viaproxy/cli/options/Options.java @@ -81,7 +81,7 @@ public class Options { final OptionSpec proxyUrl = parser.acceptsAll(asList("proxy_url", "proxy"), "URL of a SOCKS(4/5)/HTTP(S) proxy which will be used for backend TCP connections").withRequiredArg().ofType(String.class); final OptionSpec serverHaProxyProtocol = parser.acceptsAll(asList("server-haproxy-protocol", "server-haproxy"), "Send HAProxy protocol messages to the backend server"); final OptionSpec legacyClientPassthrough = parser.acceptsAll(asList("legacy_client_passthrough", "legacy_passthrough"), "Allow <= 1.6.4 clients to connect to the backend server (No protocol translation)"); - final OptionSpec allowEaglerCraftClients = parser.acceptsAll(asList("allow_eaglercraft_clients", "allow_eaglercraft"), "Allow EaglerCraft clients to connect to ViaProxy"); + final OptionSpec allowEaglerCraftClients = parser.acceptsAll(asList("allow_eaglercraft_clients", "allow_eaglercraft"), "Allow Eaglercraft clients to connect to ViaProxy"); PluginManager.EVENT_MANAGER.call(new PreOptionsParseEvent(parser)); final OptionSet options = parser.parse(args); diff --git a/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/eaglercraft/EaglercraftInitialHandler.java b/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/eaglercraft/EaglercraftInitialHandler.java index fbd2f4f..eb4c4f5 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/eaglercraft/EaglercraftInitialHandler.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/client2proxy/eaglercraft/EaglercraftInitialHandler.java @@ -67,10 +67,13 @@ public class EaglercraftInitialHandler extends ByteToMessageDecoder { ctx.pipeline().addBefore(Client2ProxyChannelInitializer.EAGLERCRAFT_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.WEBSOCKET_HANDLER_NAME, new WebSocketServerProtocolHandler("/", null, true)); ctx.pipeline().addBefore(Client2ProxyChannelInitializer.EAGLERCRAFT_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.WEBSOCKET_ACTIVE_NOTIFIER_NAME, new WebSocketActiveNotifier()); ctx.pipeline().addBefore(Client2ProxyChannelInitializer.EAGLERCRAFT_INITIAL_HANDLER_NAME, Client2ProxyChannelInitializer.EAGLERCRAFT_HANDLER_NAME, new EaglercraftHandler()); + + ctx.pipeline().fireChannelRead(in.readBytes(in.readableBytes())); + } else { + out.add(in.readBytes(in.readableBytes())); } ctx.pipeline().remove(this); - ctx.pipeline().fireChannelRead(in.retain()); } } diff --git a/src/main/java/net/raphimc/viaproxy/ui/impl/AdvancedTab.java b/src/main/java/net/raphimc/viaproxy/ui/impl/AdvancedTab.java index af2e4b3..2125c95 100644 --- a/src/main/java/net/raphimc/viaproxy/ui/impl/AdvancedTab.java +++ b/src/main/java/net/raphimc/viaproxy/ui/impl/AdvancedTab.java @@ -31,6 +31,7 @@ public class AdvancedTab extends AUITab { JTextField proxy; JCheckBox proxyOnlineMode; JCheckBox legacySkinLoading; + JCheckBox eaglercraftSupport; public AdvancedTab(final ViaProxyUI frame) { super(frame, "Advanced"); @@ -84,6 +85,13 @@ public class AdvancedTab extends AUITab { ViaProxy.saveManager.uiSave.loadCheckBox("legacy_skin_loading", this.legacySkinLoading); contentPane.add(this.legacySkinLoading); } + { + this.eaglercraftSupport = new JCheckBox("Eaglercraft Support"); + this.eaglercraftSupport.setBounds(10, 170, 465, 20); + this.eaglercraftSupport.setToolTipText("Enabling Eaglercraft Support allows Eaglercraft clients to connect to ViaProxy"); + ViaProxy.saveManager.uiSave.loadCheckBox("eaglercraft_support", this.eaglercraftSupport); + contentPane.add(this.eaglercraftSupport); + } } @Override diff --git a/src/main/java/net/raphimc/viaproxy/ui/impl/GeneralTab.java b/src/main/java/net/raphimc/viaproxy/ui/impl/GeneralTab.java index d16eee4..fa2eedc 100644 --- a/src/main/java/net/raphimc/viaproxy/ui/impl/GeneralTab.java +++ b/src/main/java/net/raphimc/viaproxy/ui/impl/GeneralTab.java @@ -203,6 +203,7 @@ public class GeneralTab extends AUITab { final boolean betaCraftAuth = this.betaCraftAuth.isSelected(); final boolean proxyOnlineMode = ViaProxy.ui.advancedTab.proxyOnlineMode.isSelected(); final boolean legacySkinLoading = ViaProxy.ui.advancedTab.legacySkinLoading.isSelected(); + final boolean eaglercraftSupport = ViaProxy.ui.advancedTab.eaglercraftSupport.isSelected(); final String proxyUrl = ViaProxy.ui.advancedTab.proxy.getText(); try { @@ -240,6 +241,7 @@ public class GeneralTab extends AUITab { Options.PROTOCOL_VERSION = serverVersion; Options.BETACRAFT_AUTH = betaCraftAuth; Options.LEGACY_SKIN_LOADING = legacySkinLoading; + Options.ALLOW_EAGLERCRAFT_CLIENTS = eaglercraftSupport; if (authMethod == 2) { Options.OPENAUTHMOD_AUTH = true;