From d986ea08751652b43bb7babcb0c4b75ed5064e7b Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Fri, 20 Oct 2023 16:50:37 +0200 Subject: [PATCH] Added CLI option to ignore packet translation errors --- src/main/java/net/raphimc/viaproxy/cli/options/Options.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 63663f3..3e75599 100644 --- a/src/main/java/net/raphimc/viaproxy/cli/options/Options.java +++ b/src/main/java/net/raphimc/viaproxy/cli/options/Options.java @@ -49,12 +49,12 @@ public class Options { public static boolean BETACRAFT_AUTH; public static Account MC_ACCOUNT; public static URI PROXY_URL; // Example: type://address:port or type://username:password@address:port + public static boolean IGNORE_PACKET_TRANSLATION_ERRORS; // GUI only config options public static String CLASSIC_MP_PASS; public static Boolean LEGACY_SKIN_LOADING; public static boolean CHAT_SIGNING; - public static boolean IGNORE_PACKET_TRANSLATION_ERRORS; // CLI only config options public static int COMPRESSION_THRESHOLD = 256; @@ -86,6 +86,7 @@ public class Options { 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 playerInfoForwarding = parser.acceptsAll(asList("player_info_forwarding", "pif"), "Enabled BungeeCord player info forwarding"); + final OptionSpec ignorePacketTranslationErrors = parser.acceptsAll(List.of("ignore-packet-translation-errors"), "Enabling this will prevent getting disconnected from the server when a packet translation error occurs and instead only print the error in the console. This may cause issues depending on the type of packet which failed to translate"); PluginManager.EVENT_MANAGER.call(new PreOptionsParseEvent(parser)); final OptionSet options; @@ -148,6 +149,7 @@ public class Options { SERVER_HAPROXY_PROTOCOL = options.has(serverHaProxyProtocol); LEGACY_CLIENT_PASSTHROUGH = options.has(legacyClientPassthrough); PLAYER_INFO_FORWARDING = options.has(playerInfoForwarding); + IGNORE_PACKET_TRANSLATION_ERRORS = options.has(ignorePacketTranslationErrors); PluginManager.EVENT_MANAGER.call(new PostOptionsParseEvent(options)); } catch (OptionException e) { Logger.LOGGER.error("Error parsing options: " + e.getMessage());