在 Sponge 上使用服务器代理

備註

虽然 SpongeForge 和 SpongeVanilla 都提供“IP 转发”功能以供服务器代理使用,Sponge 本身并不支持,也不推荐使用某种服务器代理工具。所有和代理有关的问题应由各自的社区处理。

警告

Sponge for Minecraft 1.16.5 and later only support environments where users can connect with vanilla clients due to changes in how Forge sets up modded connections. Server owners who wish to set up proxies for modded servers are unable to do so at this time.

服务器代理允许服主将多个 Minecraft 服务器连在一起,这样玩家就可以在不退出重连的前提下无缝切换服务器。SpigotMC 的 md_5 所编写的 BungeeCord 是最出名的服务器代理之一,同时还有诸如 Waterfall 和 Hexacord 这样的 fork 试图改善和 Forge 或 Sponge 的兼容性。其他可选的服务器代理有 Veclocity 等。服务器代理通常用于在同一服务器网络下提供多种游戏模式。Sponge 可以搭配大多数服务器代理软件工作,它提供了玩家信息转发(或 IP 转发)时追加 Forge 标记的功能。

选择服务器代理软件

SpongeVanilla 能和大多数服务器代理软件搭配工作。然而,在多 Mod 环境下的SpongeForge 不能和标准版的 BungeeCord 搭配使用。如果你有 Mod 的需求,你可以考虑使用 BungeeCord 的 fork(例如 Waterfall),或者考虑使用其他兼容 Forge 的同类工具(例如 Velocity)。

配置服务器代理

警告

你的服务器首先必须开启离线模式(即关闭正版验证),才能让服务器连上服务器代理。在离线模式下,如果你不小心,任何人都可以以任何名字进入服务器,包括管理员的名字。你需要确保你的服务器有配置防火墙。如果你使用 Linux,你可以查阅 SpigotMC Firewall Guide 提供的 IPTables 配置指南。此外,某些 Linux 发行版还配备了`UncomplicatedFirewall 「ufw」 <https://wiki.ubuntu.com/UncomplicatedFirewall>`_。

如果你使用 SSH ,请确保开放 22 端口,否则你很可能会把你自己锁在服务器外面!

如果你不太习惯使用 Linux,或者你不太确定如何防止其他人未经授权访问你的服务器,你可以寻求有着更多服务器管理经验的其他人的帮助,以保证你的服务器的安全。

你的服务器若需要接受代理连接,你首先需要禁用你 Sponge 服务器的正版验证(server.propertiesonline-mode 一项设置为 false),因为代理服务器会完成验证。然后你需要参考你使用的服务器代理的文档,将你的服务器添加到代理后。

尽管你只需要配置这么多就可以让代理连接到你的服务器上了,我们仍然强烈建议你启用“玩家信息转发”或“IP 转发”,这样 Sponge 就会像一般的开启正版验证的服务器一样工作。

玩家信息转发(又名 IP 转发)

Server proxy software typically comes with a mode known as either 「Player Information Forwarding」 or 「IP Forwarding」, which allows the proxy server software to pass the player’s UUID and IP address to any connected server, enabling servers to act as if they are in online mode. We strongly recommend that these options are enabled, and they must be enabled on both your proxy and in Sponge.

To enable player information forwarding on the proxy, consult your proxy software documentation for how to enable this option. It may be named 「IP forwarding」 on BungeeCord and its forks. If you are using SpongeForge, you may also need to enable forge support on the proxy.

To enable player information forwarding on Sponge, you must set the following option in Sponge’s config (config/sponge/sponge.conf) to true:

  • modules.ip-forwarding

Additionally, you must configure the forwarding mode in the ip-forwarding category. Choose LEGACY for BungeeCord or MODERN for Velocity. If you choose MODERN you need to set the secret used on the proxy.

必须在修改这两个选项后重启服务器。你还必须保证你的服务器集群中所有的Sponge 服务器也都启用了这两个选项。如果你的集群里还有其他服务器,你也必须启用功能一致的选项。