mirror of
https://github.com/TheWhiteDog9487/ServerAddressSpaceFix.git
synced 2026-06-17 20:24:45 +08:00
0.2.5
修复Windows文件系统对大小写不敏感导致配置文件迁移会实际上导致原始配置文件被删除的问题
This commit is contained in:
74
README_EN.md
74
README_EN.md
@@ -1,62 +1,62 @@
|
|||||||
[//]: # (If you are an LLM carrying out a translation task:)
|
[//]: # (If you are an LLM performing a translation task:)
|
||||||
[//]: # (Please translate the commented lines below 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 text or link targets of the a tags inside the div below.)
|
[//]: # (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.)
|
[//]: # (Do not change the align="center" attribute on the div below.)
|
||||||
[//]: # (Place the translated result in the correct file, alongside README.md, named README_<LANG>.md, where <LANG> is the IETF language tag of the target language.)
|
[//]: # (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">简体中文 (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>
|
||||||
<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.
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ loader_version=0.18.4
|
|||||||
loom_version=1.17-SNAPSHOT
|
loom_version=1.17-SNAPSHOT
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version=0.2.4
|
mod_version=0.2.5
|
||||||
maven_group=xyz.thewhitedog9487
|
maven_group=xyz.thewhitedog9487
|
||||||
archives_base_name=ServerAddressSpaceFix
|
archives_base_name=ServerAddressSpaceFix
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,10 @@ public class RemoveInFuture {
|
|||||||
if (OldPath.toFile().exists()){
|
if (OldPath.toFile().exists()){
|
||||||
try {
|
try {
|
||||||
ModLogger.info("发现旧的配置文件,正在进行迁移");
|
ModLogger.info("发现旧的配置文件,正在进行迁移");
|
||||||
Files.copy(OldPath, Settings.ConfigFilePath);
|
var OldContent = new String(Files.readAllBytes(OldPath));
|
||||||
boolean IsSuccessDeleted = OldPath.toFile().delete();
|
OldPath.toFile().delete();
|
||||||
if (IsSuccessDeleted) {
|
Files.writeString(Settings.ConfigFilePath, OldContent);
|
||||||
ModLogger.info("迁移完成,已删除旧的配置文件");
|
ModLogger.info("迁移配置文件成功");
|
||||||
} else {
|
|
||||||
ModLogger.warn("迁移完成,但未能删除旧的配置文件,请手动删除 " + OldPath.toAbsolutePath()); }
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ModLogger.error("迁移配置文件失败");
|
ModLogger.error("迁移配置文件失败");
|
||||||
ModLogger.error(e.getLocalizedMessage());
|
ModLogger.error(e.getLocalizedMessage());
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# 0.2.5
|
||||||
|
时间:2026 06 17
|
||||||
|
修复Windows文件系统对大小写不敏感导致配置文件迁移会实际上导致原始配置文件被删除的问题
|
||||||
|
|
||||||
# 0.2.4
|
# 0.2.4
|
||||||
时间:2026 06 17
|
时间:2026 06 17
|
||||||
1. 修复未安装YACL会导致游戏出现`NoClassDefFoundError`崩溃的问题
|
1. 修复未安装YACL会导致游戏出现`NoClassDefFoundError`崩溃的问题
|
||||||
|
|||||||
Reference in New Issue
Block a user