ServerAddressSpaceFix
Fix the "unknown host" bug when adding a server or connecting directly to a server with a space at the end of the server address
Обновлён 17 июня 2026 г. · опубликован 18 октября 2023 г.
简体中文(GitHub) 简体中文(Gitea) English(GitHub) English(Gitea)
Introduction
This mod is intended to fix a bug that was reported on November 26, 2021 and still has not been fixed. Bug tracker link
Features
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.
Why this mod exists
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 was obviously DNS failing to resolve the corresponding address. Let's try pinging it first.
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 strange.
Then, after fiddling with it for a while, I found the problem.
There was a space at the end of the server address I copied.
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 guess what?
My English is completely terrible, so I did not continue talking about it. The issue description was written using a translator.
But honestly, I felt this was kind of absurd.
Since your address is a String, how hard could it be to call trim on it afterwards?
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.
So, this mod was born.
Configuration file
- 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 located at
.minecraft\config\ServerAddressSpaceFix.json5
This is just a regular JSON text file, except that JSON5 supports additional features such as comments. All properties include comments, covering things such as functionality, value ranges, types, default values, and more. You can edit it with a normal text editor. You can even edit the configuration file while the game is running; it will be applied automatically after saving.
Known issues
All known issues have been fixed. If you find any new ones, please let me know. If anyone is willing to help fix a bug, PRs are welcome ╰(°▽°)╯
License
I use the even more aggressive WTFPL than MIT.
Версии
| Версия | Канал | Игра | Загрузчики | Дата | Скачать |
|---|---|---|---|---|---|
| 0.2.5 | Релиз | 26.1, 26.1.1, 26.1.2, 26.2 | fabric | 17 июня 2026 г. | .jar (20 КБ) |
| 0.2.4 | Релиз | 26.1, 26.1.1, 26.1.2, 26.2 | fabric | 17 июня 2026 г. | .jar (20 КБ) |
| 0.2.3 | Релиз | 26.1, 26.1.1, 26.1.2 | fabric | 4 июня 2026 г. | .jar (18 КБ) |
| 0.2.2 | Релиз | 26.1, 26.1.1, 26.1.2 | fabric | 26 марта 2026 г. | .jar (12 КБ) |
| 0.2.1 | Релиз | 1.21.8, 1.21.9, 1.21.10, 1.21.11 | fabric | 30 октября 2024 г. | .jar (13 КБ) |
| 0.2.0 | Релиз | 1.21, 1.21.1, 1.21.2, 1.21.3 | fabric | 14 июня 2024 г. | .jar (12 КБ) |
| 0.1.4 | Бета | 1.20.3, 1.20.4, 1.20.5, 1.20.6 | fabric | 15 января 2024 г. | .jar (12 КБ) |
| 0.1.3 | Бета | 1.20.1, 1.20.2, 1.20.3, 1.20.4 | fabric | 28 октября 2023 г. | .jar (10 КБ) |
| 0.1.2 | Бета | 1.20.2 | fabric | 28 октября 2023 г. | .jar (9 КБ) |
| 0.1.0 | Бета | 1.20.2 | fabric | 18 октября 2023 г. | .jar (11 КБ) |
| 0.1.0 | Бета | 1.20.1 | fabric | 18 октября 2023 г. | .jar (11 КБ) |
Ченджлог
0.2.5Релиз26.1.1, 26.1.2, 26.2 · 17 июня 2026 г.
修复Windows文件系统对大小写不敏感导致配置文件迁移会实际上导致原始配置文件被删除的问题
0.2.4Релиз26.1.1, 26.1.2, 26.2 · 17 июня 2026 г.
- 修复未安装YACL会导致游戏出现
NoClassDefFoundError崩溃的问题 - 将配置文件名从
serveraddressspacefix.json5改为ServerAddressSpaceFix.json5 - 为配置文件添加版本号
- 更改Logger名称
希望Mojang找个时间把这该死的Bug给修了,我好下班
0.2.3Релиз26.1, 26.1.1, 26.1.2 · 4 июня 2026 г.
- 使用YACL Config API自动将功能开关状态保存到文件内
- 解决直接连接窗口内输入框里的服务器IP没有被移除空格处理的问题
- 在移除空格之后打印日志
- 更改ModID
0.2.2Релиз26.1, 26.1.1, 26.1.2 · 26 марта 2026 г.
更新到Minecraft 26.1
由于源码变更,更换了一个新的实现方案,稍微测试了一下没太大毛病,应该还行
( AI太好用了你们知道吗,我只需要描述我需要使用什么方法比如@Redirect @Inject注入哪个字段或者函数的哪个位置,代码就可以全自动生成,连字段描述符都不需要我弄了
0.2.1Релиз1.21.9, 1.21.10, 1.21.11 · 30 октября 2024 г.
0.2.1
时间:2024 10 30
主要内容:加大剂量
- 以前不会对服务器列表中已经保存的服务器地址进行处理,现在只要模组处于启用状态会直接对所有地址进行消除空格替换,确保不留死角。
说人话:未安装或未启用本模组时添加的服务器地址如果有空格,在启用本模组之后会在打开“多人游戏”窗口时被处理掉。
0.2.0Релиз1.21.1, 1.21.2, 1.21.3 · 14 июня 2024 г.
0.2.0
时间:2024 06 14
主要内容:
- 更新适配的游戏版本到1.21/1.21.x
- 翻译键移除thewhitedog9487的命名空间
0.1.4Бета1.20.4, 1.20.5, 1.20.6 · 15 января 2024 г.
0.1.4
时间:2024 01 15
主要内容:
- 更新开发环境到1.20.4
- 更新Fabric Loader和Fabric API的版本
- 使用YetAnotherConfigLib和ModMenu为模组创建一个配置屏幕
- 配置选项中增加是否启用模组功能的开关
- 移除自使用Redirect注解之后不再被需要的接口和方法
- 在客户端侧的初始化方法中,让日志记录器打印一段日志,方便调试和除错
- 更新Mixin注入的类的路径(这东西居然更新了)
0.1.3Бета1.20.2, 1.20.3, 1.20.4 · 28 октября 2023 г.
0.1.3
时间:2023 10 28
主要内容:这玩意好像不具备特定版本兼容性啊,那我直接改兼容性列表以大版本作为兼容性边界得了,1.20全版本通用一个分支和同一个输出。
按理来说是不太至于出意外的,但如果真出了意外那我们后面再说。
Полная история изменений — на Modrinth.
Комментарии
Загружаем…