Added CLI option to ignore packet translation errors

This commit is contained in:
RaphiMC 2023-10-20 16:50:37 +02:00
parent 598626c610
commit d986ea0875
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94

View File

@ -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<Void> serverHaProxyProtocol = parser.acceptsAll(asList("server-haproxy-protocol", "server-haproxy"), "Send HAProxy protocol messages to the backend server");
final OptionSpec<Void> 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<Void> playerInfoForwarding = parser.acceptsAll(asList("player_info_forwarding", "pif"), "Enabled BungeeCord player info forwarding");
final OptionSpec<Void> 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());