Server Redirect
这个模组为服务器提供了一种轻量级的方式,用于将玩家转移到另一个服务器地址,而无需使用代理服务器。
Server Redirect 支持 Forge、Fabric、Bukkit/Spigot、SpongeVanilla/SpongeForge、Bungeecord/Waterfall 和 Velocity。
借助 Server Redirect,服务器管理员可以避免由代理服务器(Bungeecord、Waterfall 和 Velocity)引起的模组不兼容问题。 特别是,此模组可以与 Waterfall 和 Forge 1.13+ 服务器及客户端结合使用,提供在服务器之间转移玩家的方式(目前,1.13+ 的 Forge 服务器需要设置为“online”模式,因为它们尚未包含 IP 转发功能……)。
此模组是可选的,因此它可以添加到整合包中,玩家仍然可以在没有此模组的情况下加入服务器。同样,安装了此模组的服务器也可以被没有此模组的客户端加入。
命令
- /redirect <Target> <Server Address>:将指定的目标玩家重定向到指定地址
- /fallback <Target> <Server Address>:为指定的目标玩家设置备用服务器地址
- /ifplayercanredirect <Target> <Command...>:对每个安装了 Server Redirect 的目标玩家执行指定的命令
- /ifplayercannotredirect <Target> <Command...>:对每个未安装 Server Redirect 的目标玩家执行指定的命令
命令来源可以是任何能够执行命令的对象,例如命令方块、玩家或控制台。 将 /redirect 替换为 /fallback,即可让指定的目标玩家在被强制断开与服务器的连接时,连接到指定的服务器地址。
<Target> 参数可以是以下之一:
- 玩家名称/UUID:服务器上的指定玩家
- 目标选择器:一个目标选择器。目标选择器在 Bungeecord 和 Velocity 上不可用。
- r=N:距离命令发送者 N 格以内的所有玩家,如果由控制台执行,则为距离主世界出生点 N 格以内的所有玩家。仅限插件版本。
- s=<ServerName>:指定 ServerName 中的所有玩家。仅限 Bungeecord 和 Velocity。
- *:服务器上的所有玩家。
<Command...> 参数可以包含以下占位符:
- %PlayerName:此占位符将被替换为玩家的名称
- %PlayerId:此占位符将被替换为玩家的 UUID
注意:如果在目标玩家刚刚加入服务器时执行 /ifplayercanredirect 和 /ifplayercannotredirect,它们很可能无法按预期工作。这些命令依赖于客户端向服务器发送一个数据包,告知服务器他们安装了此模组。此数据包需要一些时间才能由客户端发送并由服务器处理。建议在玩家加入服务器后至少延迟 20 tick 再执行此命令!
示例:
- /redirect KaiNoMood myawesomemcserver.net:25667:名为 KaiNoMood 的玩家将连接到 myawesomemcserver.net:25667
- /redirect a54a7884-9ea4-4d54-ac35-1623d70ffbe1 myawesomemcserver.net:25667:具有指定 UUID 的玩家将连接到 myawesomemcserver.net:25667
- /redirect * myawesomemcserver.net:25667:服务器上的所有玩家将连接到 myawesomemcserver.net:25667。
- /redirect @a[m=creative] myawesomemcserver.net:25667:所有处于创造模式的玩家将连接到 myawesomemcserver.net:25667。
- /redirect r=10 myawesomemcserver.net:25667:距离命令发送者 6 格以内的所有玩家将连接到 myawesomemcserver.net:25667。此功能仅在基于 Bukkit 和 Sponge 的服务器上有效。
- /redirect s=lobby myawesomemcserver.net:25667:位于“lobby”服务器的所有玩家将连接到 myawesomemcserver.net:25667。此功能仅在 Bungeecord 和 Velocity 代理服务器上有效。
- /ifplayercanredirect * say %PlayerName is online and using Server Redirect! Yay!:指定的命令将对服务器上每个安装了 Server Redirect 的玩家执行。
- /ifplayercannotredirect @a[distance=..5] tell %PlayerName It does not seem you have Server Redirect installed! Make sure to install it!:指定的命令将对距离命令来源 5 格以内所有未安装 Server Redirect 的玩家执行。
将 /redirect 替换为 /fallback,即可为目标玩家设置备用地址。有关 fallback 命令的更多信息,请阅读下文。
常见问题
此模组如何重定向玩家
- 通过运行 /redirect 命令,服务器将向指定的玩家发送一个包含指定服务器地址的“transfer”数据包。
- 所有收到该数据包且安装了 ServerRedirect 模组的玩家将与服务器断开连接,并自动直接连接到指定的服务器地址。
任何可以通过“直接连接”按钮连接到的服务器地址都可以使用。 “transfer”数据包不会影响未安装该模组的玩家:他们只会保持与当前服务器的连接。 这与“Minecraft: Bedrock Edition”中的 transfer 数据包行为类似,该功能是 Mojang 默认在该客户端中包含的。遗憾的是,“Minecraft: Java Edition”完全缺少此功能。 redirect 和 fallback 命令都不应由玩家执行。它们旨在由控制台、命令方块和其他插件执行。建议使用命令别名和“服务器选择器”GUI(参见 BossShop 或 VirtualChest)。
fallback 命令的用途
fallback 命令告诉客户端,在他们被强制断开与服务器的连接时(例如服务器崩溃),应该连接到哪个服务器地址。
服务器管理员希望让服务器在每位玩家加入时自动执行 fallback 命令,以此使用此功能。如果服务器因任何原因关闭,玩家将自动直接连接到 fallback 命令中指定的备用服务器地址。
fallback 功能的另一个用途是当你想将玩家重定向到某个服务器,但他们可能因某些原因(例如服务器离线)而被拒绝时。首先,将玩家的 fallback 地址设置为一个你确信他们能够连接的服务器地址,然后使用 redirect 命令将玩家重定向到他们可能被拒绝的服务器地址。如果玩家无法加入他们被重定向到的服务器,他们将自动加入备用服务器。
使用此模组而非 Bungeecord、Waterfall 或 Velocity 等代理的原因
Forge 模组并不总是预料到玩家会从一个服务器被转移到另一个服务器,当代理将玩家转移到不同的服务器时,可能会导致故障或崩溃。Forge 模组通常期望在连接到另一个服务器之前先与当前服务器断开连接。此外,Forge 1.13+ 不支持代理的服务器切换。此模组通过正确地断开玩家与服务器的连接,然后将他们连接到另一个服务器来解决这个问题。这样,模组就能正确处理玩家从一个服务器切换到另一个服务器的情况。
服务器管理员也可以将代理与 Server Redirect 结合使用,如果他们想使用代理提供的所有其他功能(目前 Forge 1.13+ 服务器除外)。不过,建议考虑用跨服务器插件和模组来替代代理。
安装了此模组的玩家可以加入未安装此模组的服务器
无论是否安装此模组,任意组合都允许玩家连接到服务器。安装了此模组的玩家也可以连接到原版服务器,使用原版 Minecraft 的玩家也可以连接到安装了此模组的服务器。
此模组可以添加到整合包中
欢迎将此模组添加到公开和私人的整合包中。无需请求许可。如果你将 Server Redirect 添加到你的公开整合包中,欢迎在下方评论中告知大家!虽然此模组不应与任何其他模组冲突,但欢迎在此处报告冲突。
许可证与项目改进
此项目基于 MIT 许可证。欢迎复刻此项目或在Issues 页面上建议新功能!如果你找不到适合你的 Minecraft 版本的 Server Redirect,欢迎在那里提问!
如果你想请我吃披萨,点击此处!非常感谢!:)
Server Redirect
This mod provides a lightweight way for servers to transfer players to another server address, without the use of a proxy server.
Server Redirect supports Forge, Fabric, Bukkit/Spigot, SpongeVanilla/SpongeForge, Bungeecord/Waterfall and Velocity.
With Server Redirect, server admins can avoid mod incompatibility issues caused by proxy servers (Bungeecord, Waterfall, and Velocity). In particular, this mod can be used in combination with Waterfall and Forge 1.13+ servers and clients to provide a way to transfer players between servers (currently, the 1.13+ Forge server needs to be "online" as they haven't included IP forwarding yet...).
This mod is optional, so it can be added to modpacks and players can still join servers without this mod. Likewise, servers with this mod can be joined by clients without this mod.
Commands
- /redirect <Target> <Server Address>: redirects the specified target player(s) to the specified address
- /fallback <Target> <Server Address>: sets the fallback server address for the specified target player(s)
- /ifplayercanredirect <Target> <Command...>: runs the specified command for each of the target player(s) that have Server Redirect
- /ifplayercannotredirect <Target> <Command...>: runs the specified command for each of the target player(s) that have not Server Redirect
The command source can be anything that can run a command, like a command block, a player, or console. Replace /redirect with /fallback to have the specified target players connect to the specified server address when they get forcefully disconnected from the server.
The <Target> argument can be one of the following:
- Player Name/UUID: the specified player on the server
- Target Selector: a target selector. Target selectors are not available on Bungeecord and Velocity.
- r=N: all players within N blocks from the command sender, or from the overworld spawn if run by console. Plugin version only.
- s=<ServerName>: all players in the specified ServerName. Bungeecord and Velocity only.
- *: all players on the server.
The <Command...> argument can contain the following placeholders:
- %PlayerName: this placeholder will be replaced with the player's name
- %PlayerId: this placeholder will be replaced with the player's UUID
NOTICE: /ifplayercanredirect and /ifplayercannotredirect will likely not work as expected if run when the target player just joined the server. These commands rely on the client sending a packet to the server telling them they have this mod installed. This packet requires some time to be sent by the client and processed by the server. It is recommended to delay this command execution by at least 20 ticks after the player has joined the server!
Examples:
- /redirect KaiNoMood myawesomemcserver.net:25667: the player named KaiNoMood will connect to myawesomemcserver.net:25667
- /redirect a54a7884-9ea4-4d54-ac35-1623d70ffbe1 myawesomemcserver.net:25667: the player with the specified UUID will connect to myawesomemcserver.net:25667
- /redirect * myawesomemcserver.net:25667: all players on the server will connect to myawesomemcserver.net:25667.
- /redirect @a[m=creative] myawesomemcserver.net:25667: all players in creative mode will connect to myawesomemcserver.net:25667.
- /redirect r=10 myawesomemcserver.net:25667: all players within 6 blocks from the command sender will connect to myawesomemcserver.net:25667. This works on Bukkit and Sponge based servers only.
- /redirect s=lobby myawesomemcserver.net:25667: all players in the "lobby" server will connect to myawesomemcserver.net:25667. This works on Bungeecord and Velocity proxy servers only.
- /ifplayercanredirect * say %PlayerName is online and using Server Redirect! Yay!: the specified command will run for each player on the server that has Server Redirect.
- /ifplayercannotredirect @a[distance=..5] tell %PlayerName It does not seem you have Server Redirect installed! Make sure to install it!: the specified command will run for all players without Server Redirect within 5 blocks of the command source.
Replace /redirect with /fallback for setting a fallback address for the target players. For more info about the fallback command, read below.
FAQ
How this mod redirects players
- By running the /redirect command, the server will send a "transfer" packet containing the specified server address to the specified players.
- All players receiving the packet that have the ServerRedirect mod installed will disconnect from the server, and automatically direct connect to the specified server address.
Any server address that is reachable by the players with the "Direct Connect" button can be used.
The "transfer" packet will not affect players without the mod installed: they will simply stay connected on the current server.
This behaves like the transfer packet present in "Minecraft: Bedrock Edition", feature included by Mojang by default on that client. Regrettably, "Minecraft: Java Edition" is missing this feature entirely.
Both the redirect and fallback commands are not supposed to be run by players. They are intended for being run by the console, command blocks and other plugins. Command aliases and "server selector" GUIs are recommended (see BossShop or VirtualChest).
What the fallback command is for
The fallback command tells the clients which server address they should connect to in case they get forcefully disconnected from the server (e.g. the server crashes).
Server admins want to use this by running the fallback command automatically by the server for every player that joins the server. If the server shuts down for any reason, the players will automatically direct connect to the fallback server address specified in the fallback command.
Another use of the fallback feature is when you want to redirect a player to a server, but they might get rejected for some reason (e.g. the server is offline). First, set the fallback address for the player to a server address you can be sure they can reach, then use the redirect command to redirect the player to the server address they might get rejected from. If the player cannot join the server they were redirected to, they'll automatically join the fallback server.
Reasons for using this mod instead of a proxy like Bungeecord, Waterfall or Velocity
Forge mods don't always expect that the player is being moved from one server to another, and when a proxy transfers a player to a different server, it can cause glitches or crashes. Forge mods commonly expect to be disconnected from the server before connecting to another one. Additionally, Forge 1.13+ does not support proxies server switching. This mod solves the issue by properly disconnecting players from the server, and then connecting them to another server. This way, mods can properly handle players switching from a server to another.
Server admins can also use a combination of a proxy and Server Redirect if they want to use all the other features proxies can provide (except on Forge 1.13+ servers currently). Still, it is suggested to look into replacing the proxy with cross-server plugins and mods.
Players with this mod can join servers without this mod
Any combination of presence/absence of this mod will let players connect to servers. Players with this mod can connect to Vanilla servers as well, and players with vanilla Minecraft can also connect to servers with this mod.
This mod can be added in modpacks
Feel free to add this modpack in public and private modpacks. Asking for permission is not required. If you add Server Redirect to your public modpack, feel free to let everyone know in the comments below! Although this mod shouldn't have any conflict with any other mod, feel free to report conflicts here.
License and improvements to the project
This project is MIT licensed. Feel free to fork this project and/or suggest new features on the Issues page! If you cannot find the right version of Server Redirect for your Minecraft version, feel free to ask there!
If you wish to buy me a pizza, click here! I appreciate it very much! :)
下载 服务器重定向
下载 服务器重定向
下载 服务器重定向
下载 服务器重定向
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 服务器重定向
下载 服务器重定向
下载 服务器重定向
下载 服务器重定向
下载 服务器重定向
下载 服务器重定向
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
插件
用于绘制游戏内地图或在浏览器中随探索实时进行地图绘制的实时地图。
评论 0
登录后参与评分
还没有评论,来抢沙发吧