From 565fc90dd7b74aa3e8262efdce611a2cd1b08487 Mon Sep 17 00:00:00 2001 From: Haowei Wen Date: Sun, 20 Mar 2022 05:52:54 +0800 Subject: [PATCH] add authlibinjector.mojangAntiFeatures option --- README.en.md | 13 +++++++++++++ README.md | 13 +++++++++++++ .../moe/yushi/authlibinjector/AuthlibInjector.java | 5 ++++- src/main/java/moe/yushi/authlibinjector/Config.java | 4 +++- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.en.md b/README.en.md index 3bb0dd4..f999131 100644 --- a/README.en.md +++ b/README.en.md @@ -81,4 +81,17 @@ Configure Minecraft server with the following JVM parameter: Do not show authentication server name in Minecraft menu screen. By default, authlib-injector alters --versionType parameter to display the authentication server name. This feature can be disabled using this option. + +-Dauthlibinjector.mojangAntiFeatures={default|enabled|disabled} + Whether to turn on Minecraft's anti-features. + It's enabled by default if the authentication server does NOT send feature.enable_mojang_anti_features option. + + These anti-features include: + - Minecraft server blocklist + - The API to query user privileges: + * Online chat (allowed if the option is disabled) + * Multiplayer (allowed if the option is disabled) + * Realms (allowed if the option is disabled) + * Telemetry (turned off if the option is disabled) + * Profanity filter (turned off if the option is disabled) ``` diff --git a/README.md b/README.md index c727e5c..8d5ffc4 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,19 @@ gradle -Dauthlibinjector.noShowServerName 不要在 Minecraft 主界面展示验证服务器名称. 默认情况下, authlib-injector 通过更改 --versionType 参数来在 Minecraft 主界面显示验证服务器名称, 使用本选项可以禁用该功能. + +-Dauthlibinjector.mojangAntiFeatures={default|enabled|disabled} + 设置是否开启 Minecraft 的部分 anti-feature. + 若验证服务器未设置 feature.enable_mojang_anti_features 选项, 则默认禁用. + + Minecraft 的 anti-feature 包括: + - Minecraft 服务器屏蔽列表 + - 查询用户权限的接口, 涵盖以下项目: + * 聊天权限 (禁用后默认允许) + * 多人游戏权限 (禁用后默认允许) + * 领域权限 (禁用后默认允许) + * 遥测 (禁用后默认关闭) + * 冒犯性内容过滤 (禁用后默认关闭) ``` ## 捐助 diff --git a/src/main/java/moe/yushi/authlibinjector/AuthlibInjector.java b/src/main/java/moe/yushi/authlibinjector/AuthlibInjector.java index a847a1d..a1d4fd2 100644 --- a/src/main/java/moe/yushi/authlibinjector/AuthlibInjector.java +++ b/src/main/java/moe/yushi/authlibinjector/AuthlibInjector.java @@ -243,7 +243,10 @@ public final class AuthlibInjector { log(INFO, "Disabled Mojang namespace"); } - filters.add(new AntiFeaturesFilter()); + boolean mojangAntiFeaturesDefault = Boolean.TRUE.equals(config.getMeta().get("feature.enable_mojang_anti_features")); + if (!Config.mojangAntiFeatures.isEnabled(mojangAntiFeaturesDefault)) { + filters.add(new AntiFeaturesFilter()); + } return filters; } diff --git a/src/main/java/moe/yushi/authlibinjector/Config.java b/src/main/java/moe/yushi/authlibinjector/Config.java index 5f812f1..8c4a239 100644 --- a/src/main/java/moe/yushi/authlibinjector/Config.java +++ b/src/main/java/moe/yushi/authlibinjector/Config.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Haowei Wen and contributors + * Copyright (C) 2022 Haowei Wen and contributors * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -59,6 +59,7 @@ public final class Config { public static Set ignoredPackages; public static FeatureOption mojangNamespace; public static FeatureOption legacySkinPolyfill; + public static FeatureOption mojangAntiFeatures; public static boolean noShowServerName; private static void initDebugOptions() { @@ -202,6 +203,7 @@ public final class Config { mojangNamespace = parseFeatureOption("authlibinjector.mojangNamespace"); legacySkinPolyfill = parseFeatureOption("authlibinjector.legacySkinPolyfill"); + mojangAntiFeatures = parseFeatureOption("authlibinjector.mojangAntiFeatures"); httpdDisabled = System.getProperty("authlibinjector.disableHttpd") != null; noShowServerName = System.getProperty("authlibinjector.noShowServerName") != null; }