mirror of
https://github.com/TheWhiteDog9487/ServerAddressSpaceFix.git
synced 2026-07-12 21:41:09 +00:00
Compare commits
2 Commits
92d1e282d8
...
主要
| Author | SHA1 | Date | |
|---|---|---|---|
| ca8953d52e | |||
| abd1378634 |
@@ -1,10 +1,12 @@
|
|||||||
[//]: # (如果你是正在执行翻译任务的LLM:)
|
[//]: # (如果你是正在执行翻译任务的LLM:)
|
||||||
[//]: # (请将这几行注释内容翻译到你的目标语言)
|
[//]: # (请将这几行注释内容翻译到你的目标语言)
|
||||||
[//]: # (移除下方div内部第一行和第二行的注释符号,并翻译其内容)
|
[//]: # (移除下方div内部第一行和第二行的注释符号,并翻译其内容)
|
||||||
[//]: # (不要翻译最后一段“一些小彩蛋”,直接将其从翻译版本中移除)
|
[//]: # (不要翻译下方div内部a标签的文本内容和链接地址)
|
||||||
|
[//]: # (不要改动下方div标签的align="center"属性)
|
||||||
|
[//]: # (将翻译的结果放置到正确的文件内,目标文件的位置和主README.md同级,文件名格式是 README_<LANG>.md ,其中<LANG>的值是目标语言的IETF语言标签)
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<!-- <strong>注意:本文档由中文编写。如果条件允许,建议阅读原始的中文文档而不是其他的翻译版本。</strong> -->
|
<!-- <strong>注意:本文档由中文编写,使用AI翻译到其他语言。如果条件允许,建议阅读原始的中文文档而不是其他的翻译版本。</strong> -->
|
||||||
<!-- <br/> -->
|
<!-- <br/> -->
|
||||||
<a href="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文(GitHub)</a>
|
<a href="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文(GitHub)</a>
|
||||||
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/ServerAddressSpaceFix/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文(Gitea)</a>
|
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/ServerAddressSpaceFix/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文(Gitea)</a>
|
||||||
@@ -43,8 +45,8 @@
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
# 配置文件
|
# 配置文件
|
||||||
- 如果你开启了版本隔离,它应当位于`.minecraft\versions\<版本名>\config\serveraddressspacefix.json5`
|
- 如果你开启了版本隔离,它应当位于`.minecraft\versions\<版本名>\config\ServerAddressSpaceFix.json5`
|
||||||
- 如果没有版本隔离,它应该在`.minecraft\config\serveraddressspacefix.json5`
|
- 如果没有版本隔离,它应该在`.minecraft\config\ServerAddressSpaceFix.json5`
|
||||||
|
|
||||||
这就是一个普通的json文本文件,只不过json5支持诸如注释等更多特性而已。
|
这就是一个普通的json文本文件,只不过json5支持诸如注释等更多特性而已。
|
||||||
所有的属性都有注释,包括功能、取值范围、类型、默认值等。
|
所有的属性都有注释,包括功能、取值范围、类型、默认值等。
|
||||||
|
|||||||
+39
-37
@@ -1,60 +1,62 @@
|
|||||||
[//]: # (If you are an LLM carrying out a translation task:)
|
[//]: # (If you are an LLM performing a translation task:)
|
||||||
[//]: # (Please translate these commented lines into your target language.)
|
[//]: # (Translate these comment lines into your target language.)
|
||||||
[//]: # (Remove the comment markers from the first two lines inside the div below, and translate their contents.)
|
[//]: # (Remove the comment markers from the first and second lines inside the div below, and translate their content.)
|
||||||
[//]: # (Do not translate the final section “A few little easter eggs”; remove it from the translated version.)
|
[//]: # (Do not translate the text content or link targets of the a tags inside the div below.)
|
||||||
|
[//]: # (Do not change the align="center" attribute on the div below.)
|
||||||
|
[//]: # (Place the translated result in the correct file. The target file should be at the same level as the main README.md, and the filename should be README_<LANG>.md, where <LANG> is the target language's IETF language tag.)
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<strong>Note: This document was originally written in Chinese. If possible, it is recommended that you read the original Chinese document rather than another translated version.</strong>
|
<strong>Note: This document was originally written in Chinese and translated to other languages by AI. If possible, I recommend reading the original Chinese document instead of a translated version.</strong>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/README.md">Simplified Chinese (GitHub)</a>
|
<a href="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/README.md">简体中文(GitHub)</a>
|
||||||
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/ServerAddressSpaceFix/src/branch/%E4%B8%BB%E8%A6%81/README.md">Simplified Chinese (Gitea)</a>
|
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/ServerAddressSpaceFix/src/branch/%E4%B8%BB%E8%A6%81/README.md">简体中文(Gitea)</a>
|
||||||
<a href="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/README_EN.md">English (GitHub)</a>
|
<a href="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/README_EN.md">English(GitHub)</a>
|
||||||
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/ServerAddressSpaceFix/src/branch/%E4%B8%BB%E8%A6%81/README_EN.md">English (Gitea)</a>
|
<a href="https://git.thewhitedog9487.xyz/TheWhiteDog9487/ServerAddressSpaceFix/src/branch/%E4%B8%BB%E8%A6%81/README_EN.md">English(Gitea)</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
# Introduction
|
# Introduction
|
||||||
This mod aims to fix a bug that was reported on 26 November 2021 but has still not been fixed.
|
This mod is intended to fix a bug that was reported on November 26, 2021 and still has not been fixed.
|
||||||
[Bug tracker link](https://bugs.mojang.com/browse/MC-242809)
|
[Bug tracker link](https://bugs.mojang.com/browse/MC-242809)
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
If the server address you enter on the “Add Server” or “Direct Connect” screen contains spaces at the beginning, end, or in the middle, this mod will automatically remove them.
|
If the server address you enter on the "Add Server" or "Direct Connect" screen contains spaces at the beginning, the end, or in the middle, this mod will automatically remove them.
|
||||||
This prevents the “Unknown host” bug mentioned above.
|
This prevents the "Unknown Host" bug mentioned above.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Why this mod exists</summary>
|
<summary>Why this mod exists</summary>
|
||||||
<pre>
|
<pre>
|
||||||
A few months ago, I wanted to play on a server. I copied the address from the server’s official website, pasted it into “Server Address”, and saved it — only to get “Unknown host”.
|
A few months ago, I wanted to play on a server. I copied the address from the server's official website, pasted it into the "Server Address" field, saved it, and unexpectedly got an "Unknown Host" error.
|
||||||
No panic; this clearly meant DNS had not resolved the corresponding address, so I pinged it first.
|
No panic, this was obviously DNS failing to resolve the corresponding address. Let's try pinging it first.
|
||||||
Ping could resolve the domain’s address, and then I suspected the Great Firewall might be doing something odd again, so I tested it with the tool on Chinaz, and every result matched mine.
|
Ping could resolve the domain name to an address, and then I suspected the Great Firewall might be doing something again, so I used a tool from ZhanZhangJia to test it. The results were exactly the same as mine.
|
||||||
That was rather odd.
|
That was rather strange.
|
||||||
After fiddling with it for a while, I found the problem.
|
Then, after fiddling with it for a while, I found the problem.
|
||||||
<strong>There was a space at the end of the server address I had copied.</strong>
|
<strong>There was a space at the end of the server address I copied.</strong>
|
||||||
That was really infuriating. After messing around for a bit longer and confirming that the issue could be reproduced reliably, I submitted a bug to the tracker.
|
That was pretty hard to accept. After continuing to tinker for a while and confirming that the problem could be reproduced reliably, I submitted a bug report to the tracker.
|
||||||
And what do you think happened?
|
And guess what?
|
||||||
<img src="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/%E5%9B%BE%E7%89%87/Snipaste_2023-10-18_15-22-39.png?raw=true" alt="The issue I filed on the bug tracker" srcset="">
|
<img src="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/%E5%9B%BE%E7%89%87/Snipaste_2023-10-18_15-22-39.png?raw=true" alt="The issue I filed on the bug tracker" srcset="">
|
||||||
<img src="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/%E5%9B%BE%E7%89%87/Snipaste_2023-10-18_15-22-47.png?raw=true" alt="The comment below" srcset="">
|
<img src="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/%E5%9B%BE%E7%89%87/Snipaste_2023-10-18_15-22-47.png?raw=true" alt="The comment below" srcset="">
|
||||||
<img src="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/%E5%9B%BE%E7%89%87/Snipaste_2023-10-18_15-22-57.png?raw=true" alt="An even earlier bug report" srcset="">
|
<img src="https://github.com/TheWhiteDog9487/ServerAddressSpaceFix/blob/%E4%B8%BB%E8%A6%81/%E5%9B%BE%E7%89%87/Snipaste_2023-10-18_15-22-57.png?raw=true" alt="An earlier bug report" srcset="">
|
||||||
My English is absolutely terrible, so I did not keep going; the problem description was written using translation tools.
|
My English is completely terrible, so I did not continue talking about it. The issue description was written using a translator.
|
||||||
But deep down, I still thought this was rather absurd.
|
But honestly, I felt this was kind of absurd.
|
||||||
Since your address is a String, how hard can it be to call trim afterwards?
|
Since your address is a String, how hard could it be to call trim on it afterwards?
|
||||||
And as a player, when you tell me, “This was all your own carelessness; it does not even count as a bug,” I cannot accept that.
|
Also, as a player, when you tell me, "This was your own carelessness, so it does not even count as a bug," I cannot accept that.
|
||||||
<strong>So, this mod came to be.</strong>
|
<strong>So, this mod was born.</strong>
|
||||||
</pre>
|
</pre>
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
# Configuration
|
# Configuration file
|
||||||
- If you have version isolation enabled, it should be located at `.minecraft\versions\<version name>\config\serveraddressspacefix.json5`
|
- If you have version isolation enabled, it should be located at `.minecraft\versions\<version name>\config\ServerAddressSpaceFix.json5`
|
||||||
- If you do not have version isolation enabled, it should be at `.minecraft\config\serveraddressspacefix.json5`
|
- If you do not have version isolation enabled, it should be located at `.minecraft\config\ServerAddressSpaceFix.json5`
|
||||||
|
|
||||||
This is just a regular JSON text file, except that JSON5 supports extra features such as comments.
|
This is just a regular JSON text file, except that JSON5 supports additional features such as comments.
|
||||||
All properties are annotated, including their purpose, range of values, type, default value, and so on.
|
All properties include comments, covering things such as functionality, value ranges, types, default values, and more.
|
||||||
You can open it in a plain text editor and modify it.
|
You can edit it with a normal text editor.
|
||||||
You can edit the config file while the game is running; once saved, the changes will be applied in-game automatically.
|
You can even edit the configuration file while the game is running; it will be applied automatically after saving.
|
||||||
|
|
||||||
# Known issues
|
# Known issues
|
||||||
All known issues have been fixed; if you find any new ones, please let me know.
|
All known issues have been fixed. If you find any new ones, please let me know.
|
||||||
If anyone is willing to help me fix the bug, please submit a PR ╰(*°▽°*)╯
|
If anyone is willing to help fix a bug, PRs are welcome ╰(*°▽°*)╯
|
||||||
|
|
||||||
# Licence
|
# License
|
||||||
I use the more radical WTFPL rather than MIT.
|
I use the even more aggressive WTFPL than MIT.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import java.nio.file.Paths
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("net.fabricmc.fabric-loom")
|
id("net.fabricmc.fabric-loom")
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
@@ -22,6 +24,27 @@ repositories {
|
|||||||
name = "Nucleoid"
|
name = "Nucleoid"
|
||||||
url = uri("https://maven.nucleoid.xyz/") } }
|
url = uri("https://maven.nucleoid.xyz/") } }
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
val MixinJarPath = configurations.loaderLibraries.get().resolvedConfiguration
|
||||||
|
.resolvedArtifacts
|
||||||
|
.find { it.moduleVersion.id.group == "net.fabricmc" && it.moduleVersion.id.name == "sponge-mixin" }!!
|
||||||
|
.file
|
||||||
|
val IsSupportDceVM = Paths.get(System.getProperty("java.home"))
|
||||||
|
.resolve("bin")
|
||||||
|
.resolve("java")
|
||||||
|
.toFile()
|
||||||
|
.let {
|
||||||
|
val ReturnCode = ProcessBuilder(it.absolutePath, "-XX:+AllowEnhancedClassRedefinition", "-version")
|
||||||
|
.start()
|
||||||
|
.waitFor()
|
||||||
|
return@let ReturnCode == 0 }
|
||||||
|
loom.runs.named("client") {
|
||||||
|
jvmArguments.add("-javaagent:${MixinJarPath.absolutePath}")
|
||||||
|
if (IsSupportDceVM == true) jvmArguments.add("-XX:+AllowEnhancedClassRedefinition") }
|
||||||
|
loom.runs.named("server") {
|
||||||
|
jvmArguments.add("-javaagent:${MixinJarPath.absolutePath}")
|
||||||
|
if (IsSupportDceVM == true) jvmArguments.add("-XX:+AllowEnhancedClassRedefinition") } }
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
splitEnvironmentSourceSets()
|
splitEnvironmentSourceSets()
|
||||||
|
|
||||||
|
|||||||
+3
-6
@@ -6,10 +6,10 @@ org.gradle.parallel=true
|
|||||||
# check these on https://fabricmc.net/develop
|
# check these on https://fabricmc.net/develop
|
||||||
minecraft_version=26.1
|
minecraft_version=26.1
|
||||||
loader_version=0.18.4
|
loader_version=0.18.4
|
||||||
loom_version=1.16-SNAPSHOT
|
loom_version=1.17-SNAPSHOT
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.2.3
|
mod_version=0.2.5
|
||||||
maven_group=xyz.thewhitedog9487
|
maven_group=xyz.thewhitedog9487
|
||||||
archives_base_name=ServerAddressSpaceFix
|
archives_base_name=ServerAddressSpaceFix
|
||||||
|
|
||||||
@@ -20,11 +20,8 @@ compatible_with=26.x
|
|||||||
|
|
||||||
# https://modrinth.com/mod/modmenu/versions
|
# https://modrinth.com/mod/modmenu/versions
|
||||||
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
|
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
|
||||||
modmenu_version=18.0.0-alpha.7
|
modmenu_version=18.0.0-beta.1
|
||||||
|
|
||||||
# https://modrinth.com/mod/yacl/versions
|
# https://modrinth.com/mod/yacl/versions
|
||||||
# https://maven.isxander.dev/#/releases/dev/isxander/yet-another-config-lib
|
# https://maven.isxander.dev/#/releases/dev/isxander/yet-another-config-lib
|
||||||
yacl_version=3.9.0+26.1-fabric
|
yacl_version=3.9.0+26.1-fabric
|
||||||
|
|
||||||
# https://mvnrepository.com/artifact/org.projectlombok/lombok
|
|
||||||
lombok_version=1.18.46
|
|
||||||
@@ -4,15 +4,24 @@ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
|
|||||||
import xyz.thewhitedog9487.Settings;
|
import xyz.thewhitedog9487.Settings;
|
||||||
|
|
||||||
import static xyz.thewhitedog9487.ServerAddressSpaceFixClient.ModLogger;
|
import static xyz.thewhitedog9487.ServerAddressSpaceFixClient.ModLogger;
|
||||||
import static xyz.thewhitedog9487.Settings.SettingsInstance;
|
import static xyz.thewhitedog9487.Settings.*;
|
||||||
|
|
||||||
public class ClientLifecycleEventsRegister {
|
public class ClientLifecycleEventsRegister {
|
||||||
public static void Register(){
|
public static void Register(){
|
||||||
ClientLifecycleEvents.CLIENT_STARTED.register(ClientInstance -> {
|
ClientLifecycleEvents.CLIENT_STARTED.register(ClientInstance -> {
|
||||||
|
if (Settings.SettingsHandler == null){
|
||||||
|
ModLogger.warn("当前没有安装YACL,因此无法调整和保持Mod配置");
|
||||||
|
SettingsInstance = new Settings(); }
|
||||||
|
else {
|
||||||
ModLogger.info("正在从" + Settings.ConfigFilePath + "加载设置...");
|
ModLogger.info("正在从" + Settings.ConfigFilePath + "加载设置...");
|
||||||
Settings.SettingsHandler.load();
|
Settings.SettingsHandler.load();
|
||||||
SettingsInstance = Settings.SettingsHandler.instance();
|
SettingsInstance = Settings.SettingsHandler.instance();
|
||||||
Settings.RegisterConfigFileReloadWatcher(); } );
|
if (SettingsInstance.ConfigurationVersionCode != CurrentConfigurationVersionCode){
|
||||||
|
// 必要时手动处理升降级,现在不必要,就这么办了
|
||||||
|
SettingsInstance.ConfigurationVersionCode = CurrentConfigurationVersionCode;
|
||||||
|
SettingsHandler.save(); }
|
||||||
|
Settings.RegisterConfigFileReloadWatcher(); } } );
|
||||||
ClientLifecycleEvents.CLIENT_STOPPING.register(ClientInstance -> {
|
ClientLifecycleEvents.CLIENT_STOPPING.register(ClientInstance -> {
|
||||||
|
if (Settings.SettingsHandler == null) return;
|
||||||
ModLogger.info("正在保存设置到" + Settings.ConfigFilePath + "...");
|
ModLogger.info("正在保存设置到" + Settings.ConfigFilePath + "...");
|
||||||
Settings.SettingsHandler.save(); } ); } }
|
Settings.SettingsHandler.save(); } ); } }
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package xyz.thewhitedog9487;
|
||||||
|
|
||||||
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
|
||||||
|
import static xyz.thewhitedog9487.ServerAddressSpaceFixClient.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预计27.1正式版发布后删除
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class RemoveInFuture {
|
||||||
|
@Deprecated
|
||||||
|
public static void MigrateConfiguration() {
|
||||||
|
var OldPath = FabricLoader.getInstance()
|
||||||
|
.getConfigDir()
|
||||||
|
.resolve(ModID + ".json5")
|
||||||
|
.toAbsolutePath();
|
||||||
|
if (OldPath.toFile().exists()){
|
||||||
|
try {
|
||||||
|
ModLogger.info("发现旧的配置文件,正在进行迁移");
|
||||||
|
var OldContent = new String(Files.readAllBytes(OldPath));
|
||||||
|
OldPath.toFile().delete();
|
||||||
|
Files.writeString(Settings.ConfigFilePath, OldContent);
|
||||||
|
ModLogger.info("迁移配置文件成功");
|
||||||
|
} catch (IOException e) {
|
||||||
|
ModLogger.error("迁移配置文件失败");
|
||||||
|
ModLogger.error(e.getLocalizedMessage());
|
||||||
|
e.printStackTrace(); } } } }
|
||||||
@@ -7,11 +7,13 @@ import xyz.thewhitedog9487.Event.ClientLifecycleEventsRegister;
|
|||||||
|
|
||||||
public class ServerAddressSpaceFixClient implements ClientModInitializer {
|
public class ServerAddressSpaceFixClient implements ClientModInitializer {
|
||||||
public static final String ModID = "serveraddressspacefix";
|
public static final String ModID = "serveraddressspacefix";
|
||||||
public static final Logger ModLogger = LoggerFactory.getLogger(ModID);
|
public static final String FriendlyModID = "ServerAddressSpaceFix";
|
||||||
|
public static final Logger ModLogger = LoggerFactory.getLogger(FriendlyModID);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
|
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
|
||||||
|
RemoveInFuture.MigrateConfiguration();
|
||||||
ClientLifecycleEventsRegister.Register();
|
ClientLifecycleEventsRegister.Register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,15 +18,19 @@ import java.nio.file.WatchService;
|
|||||||
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
|
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
|
||||||
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
|
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
|
||||||
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
|
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
|
||||||
import static xyz.thewhitedog9487.ServerAddressSpaceFixClient.ModID;
|
import static xyz.thewhitedog9487.ServerAddressSpaceFixClient.*;
|
||||||
import static xyz.thewhitedog9487.ServerAddressSpaceFixClient.ModLogger;
|
|
||||||
|
|
||||||
public class Settings {
|
public class Settings {
|
||||||
public static Path ConfigFilePath = FabricLoader.getInstance()
|
public static Path ConfigFilePath = FabricLoader.getInstance()
|
||||||
.getConfigDir()
|
.getConfigDir()
|
||||||
.resolve(ModID + ".json5")
|
.resolve(FriendlyModID + ".json5")
|
||||||
.toAbsolutePath();
|
.toAbsolutePath();
|
||||||
public static ConfigClassHandler<Settings> SettingsHandler = ConfigClassHandler.createBuilder(Settings.class)
|
public static ConfigClassHandler<Settings> SettingsHandler = null;
|
||||||
|
public static long CurrentConfigurationVersionCode = 0;
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
SettingsHandler = ConfigClassHandler.createBuilder(Settings.class)
|
||||||
.id(Identifier.fromNamespaceAndPath(ModID, "settings_confighandler"))
|
.id(Identifier.fromNamespaceAndPath(ModID, "settings_confighandler"))
|
||||||
.serializer(SettingsConfigClassHandler -> GsonConfigSerializerBuilder.create(SettingsConfigClassHandler)
|
.serializer(SettingsConfigClassHandler -> GsonConfigSerializerBuilder.create(SettingsConfigClassHandler)
|
||||||
.setPath(ConfigFilePath)
|
.setPath(ConfigFilePath)
|
||||||
@@ -34,6 +38,8 @@ public class Settings {
|
|||||||
.setJson5(true)
|
.setJson5(true)
|
||||||
.build() )
|
.build() )
|
||||||
.build();
|
.build();
|
||||||
|
} catch (NoClassDefFoundError _) {} }
|
||||||
|
|
||||||
public static volatile Settings SettingsInstance;
|
public static volatile Settings SettingsInstance;
|
||||||
|
|
||||||
// region 配置文件变更监听器
|
// region 配置文件变更监听器
|
||||||
@@ -66,6 +72,17 @@ public class Settings {
|
|||||||
throw new RuntimeException(e); } } ) ); }
|
throw new RuntimeException(e); } } ) ); }
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
@SerialEntry(comment =
|
||||||
|
"""
|
||||||
|
配置文件版本号
|
||||||
|
用于在配置文件结构发生变化且需要手动干预时进行兼容性处理
|
||||||
|
非必要情况下你不应该手动修改这个数据,否则可能导致本Mod的配置文件出现损坏或其他问题
|
||||||
|
类型:整数
|
||||||
|
取值范围:0 ~ Long.MAX_VALUE
|
||||||
|
当前值:0
|
||||||
|
""")
|
||||||
|
public long ConfigurationVersionCode = CurrentConfigurationVersionCode;
|
||||||
|
|
||||||
@SerialEntry(comment =
|
@SerialEntry(comment =
|
||||||
"""
|
"""
|
||||||
是否启用本模组的功能
|
是否启用本模组的功能
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# 0.2.5
|
||||||
|
时间:2026 06 17
|
||||||
|
修复Windows文件系统对大小写不敏感导致配置文件迁移会实际上导致原始配置文件被删除的问题
|
||||||
|
|
||||||
|
# 0.2.4
|
||||||
|
时间:2026 06 17
|
||||||
|
1. 修复未安装YACL会导致游戏出现`NoClassDefFoundError`崩溃的问题
|
||||||
|
2. 将配置文件名从`serveraddressspacefix.json5`改为`ServerAddressSpaceFix.json5`
|
||||||
|
3. 为配置文件添加版本号
|
||||||
|
4. 更改Logger名称
|
||||||
|
|
||||||
# 0.2.3
|
# 0.2.3
|
||||||
时间:2026 06 04
|
时间:2026 06 04
|
||||||
1. 使用YACL Config API自动将功能开关状态保存到文件内
|
1. 使用YACL Config API自动将功能开关状态保存到文件内
|
||||||
|
|||||||
Reference in New Issue
Block a user