mirror of
https://github.com/unmojang/authlib-injector.git
synced 2025-10-03 08:11:04 -04:00
show auth server name in menu screen
This commit is contained in:
parent
d121ac3b7c
commit
6f236dceeb
@ -76,4 +76,9 @@ Configure Minecraft server with the following JVM parameter:
|
|||||||
Features (see below) depending on local HTTP server will be unavailable:
|
Features (see below) depending on local HTTP server will be unavailable:
|
||||||
- Mojang namespace
|
- Mojang namespace
|
||||||
- Legacy skin API polyfill
|
- Legacy skin API polyfill
|
||||||
|
|
||||||
|
-Dauthlibinjector.noShowServerName
|
||||||
|
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.
|
||||||
```
|
```
|
||||||
|
@ -75,6 +75,10 @@ gradle
|
|||||||
以下依赖内建 HTTP 服务器的功能将不可用:
|
以下依赖内建 HTTP 服务器的功能将不可用:
|
||||||
- Mojang 命名空间
|
- Mojang 命名空间
|
||||||
- 旧式皮肤 API polyfill
|
- 旧式皮肤 API polyfill
|
||||||
|
|
||||||
|
-Dauthlibinjector.noShowServerName
|
||||||
|
不要在 Minecraft 主界面展示验证服务器名称.
|
||||||
|
默认情况下, authlib-injector 通过更改 --versionType 参数来在 Minecraft 主界面显示验证服务器名称, 使用本选项可以禁用该功能.
|
||||||
```
|
```
|
||||||
|
|
||||||
## 捐助
|
## 捐助
|
||||||
|
@ -50,6 +50,7 @@ import moe.yushi.authlibinjector.httpd.URLFilter;
|
|||||||
import moe.yushi.authlibinjector.httpd.URLProcessor;
|
import moe.yushi.authlibinjector.httpd.URLProcessor;
|
||||||
import moe.yushi.authlibinjector.transform.ClassTransformer;
|
import moe.yushi.authlibinjector.transform.ClassTransformer;
|
||||||
import moe.yushi.authlibinjector.transform.DumpClassListener;
|
import moe.yushi.authlibinjector.transform.DumpClassListener;
|
||||||
|
import moe.yushi.authlibinjector.transform.support.AuthServerNameInjector;
|
||||||
import moe.yushi.authlibinjector.transform.support.AuthlibLogInterceptor;
|
import moe.yushi.authlibinjector.transform.support.AuthlibLogInterceptor;
|
||||||
import moe.yushi.authlibinjector.transform.support.CitizensTransformer;
|
import moe.yushi.authlibinjector.transform.support.CitizensTransformer;
|
||||||
import moe.yushi.authlibinjector.transform.support.ConstantURLTransformUnit;
|
import moe.yushi.authlibinjector.transform.support.ConstantURLTransformUnit;
|
||||||
@ -94,6 +95,9 @@ public final class AuthlibInjector {
|
|||||||
ProxyParameterWorkaround.init();
|
ProxyParameterWorkaround.init();
|
||||||
MC52974Workaround.init();
|
MC52974Workaround.init();
|
||||||
MC52974_1710Workaround.init();
|
MC52974_1710Workaround.init();
|
||||||
|
if (!Config.noShowServerName) {
|
||||||
|
AuthServerNameInjector.init(apiMetadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Optional<String> getPrefetchedResponse() {
|
private static Optional<String> getPrefetchedResponse() {
|
||||||
|
@ -59,6 +59,7 @@ public final class Config {
|
|||||||
public static Set<String> ignoredPackages;
|
public static Set<String> ignoredPackages;
|
||||||
public static FeatureOption mojangNamespace;
|
public static FeatureOption mojangNamespace;
|
||||||
public static FeatureOption legacySkinPolyfill;
|
public static FeatureOption legacySkinPolyfill;
|
||||||
|
public static boolean noShowServerName;
|
||||||
|
|
||||||
private static void initDebugOptions() {
|
private static void initDebugOptions() {
|
||||||
String prop = System.getProperty("authlibinjector.debug");
|
String prop = System.getProperty("authlibinjector.debug");
|
||||||
@ -202,5 +203,6 @@ public final class Config {
|
|||||||
mojangNamespace = parseFeatureOption("authlibinjector.mojangNamespace");
|
mojangNamespace = parseFeatureOption("authlibinjector.mojangNamespace");
|
||||||
legacySkinPolyfill = parseFeatureOption("authlibinjector.legacySkinPolyfill");
|
legacySkinPolyfill = parseFeatureOption("authlibinjector.legacySkinPolyfill");
|
||||||
httpdDisabled = System.getProperty("authlibinjector.disableHttpd") != null;
|
httpdDisabled = System.getProperty("authlibinjector.disableHttpd") != null;
|
||||||
|
noShowServerName = System.getProperty("authlibinjector.noShowServerName") != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Haowei Wen <yushijinhun@gmail.com> 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package moe.yushi.authlibinjector.transform.support;
|
||||||
|
|
||||||
|
import static moe.yushi.authlibinjector.util.Logging.log;
|
||||||
|
import moe.yushi.authlibinjector.APIMetadata;
|
||||||
|
import moe.yushi.authlibinjector.util.Logging.Level;
|
||||||
|
|
||||||
|
public final class AuthServerNameInjector {
|
||||||
|
private AuthServerNameInjector() {}
|
||||||
|
|
||||||
|
private static String getServerName(APIMetadata meta) {
|
||||||
|
Object serverName = meta.getMeta().get("serverName");
|
||||||
|
if (serverName instanceof String) {
|
||||||
|
return (String) serverName;
|
||||||
|
} else {
|
||||||
|
return meta.getApiRoot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(APIMetadata meta) {
|
||||||
|
MainArgumentsTransformer.getArgumentsListeners().add(args -> {
|
||||||
|
for (int i = 0; i < args.length - 1; i++) {
|
||||||
|
if ("--versionType".equals(args[i])) {
|
||||||
|
String serverName = getServerName(meta);
|
||||||
|
log(Level.DEBUG, "Setting versionType to server name: " + serverName);
|
||||||
|
args[i + 1] = serverName;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user