信不信由你,Minecraft 实际上通过 TRANSFER 数据包(0x7F)内置了此功能。该数据包允许服务器告知客户端断开与服务器的连接并转而连接到另一台服务器。1.20.5 及更高版本的客户端支持此数据包,在特定情况下你可能还能支持更低版本,更多信息请参阅兼容性说明。
使用此插件非常简单。它拥有相当有限的权限、命令和配置选项。以下是插件的主要命令 (/serverswap):
/serverswap
┣ swap <server> [players]
┖ reload
请注意,serverswap 命令也可以通过别名 ss 访问。交换你自己的服务器需要玩家本人运行该命令(否则要转移谁呢?)。而指定玩家进行转移或重载配置时,任何具有足够权限的执行者(如控制台,甚至如果你想要一只非常热情的猪)都可以运行。
默认情况下,插件附带以下配置文件:
# ServerSwap 配置 - 在此列出你的目标服务器
# 插件将自动为每个条目创建权限:
# serverswap.use.<server>
# serverswap.use.others.<server>
# 你也可以授予通配符权限:
# serverswap.use.*
# serverswap.use.others.*
servers:
Hub:
address: hub.example.com
port: 25565
Minigames:
address: minigames.example.com
port: 25565
autoRedirect:
play.example.com: Hub
pvp.example.com: Minigames
让我们逐一分析这些属性。首先是 servers 块,你可以在这里告诉插件去哪里找到每个服务器,它会关联一个地址和一个端口。在默认配置文件中配置了两个服务器,其中一个名为 “Hub”,链接到端口 25565(默认的 Minecraft 端口)上的 hub.example.com 服务器。
接下来是 autoRedirect 部分,这与 Velocity 的 forced-hosts 类似。简而言之,如果有人通过加入作为对象名称指定的主机名(在本例中为 play.example.com)连接到你的服务器,它会自动将他们转移到相应的服务器,例如 Hub。
有一些插件创建的默认权限,还有基于你的配置文件动态生成的权限。让我们先从静态权限开始列举:
serverswap.use / serverswap.use.*: 允许玩家将自己转移到配置文件中指定的任何服务器。默认:True
serverswap.use.others / serverswap.use.others.*: 允许执行者将其他玩家转移到配置文件中指定的任何服务器。默认:OP
serverswap.reload: 允许用户简单地重新加载插件的配置文件并根据其重新生成权限。默认:OP
至于动态权限:
serverswap.use.[serverName]: 允许玩家将自身切换到指定的服务器。
serverswap.use.others.[serverName]: 允许执行者将其他玩家转移到权限中指定的服务器。
Believe it or not, Minecraft actually has this functionallity built in through the TRANSFER packet (0x7F). This packet allows a server to tell a client to disconnect from it and connect to another instead. Clients as low as 1.20.5 support this packet, and you might be able to go even lower under specific circumstances, more info about this can be found in the compatability
Using this plugin is as simple as can be. There's a fairly limited amount of permissions, commands, and config. Below is the main command of the plugin (/serverswap)
/serverswap
┣ swap <server> [players]
┖ reload
Do note that the serverswap command is also accessible via the alias of ss. Whilst swapping your own server requires that a player be running the command (else who are transfer). Transfering whilst specifying players and reloading can be run by any executor with sufficent permissions such as console or even if you wanted a really enthusiastic pig.
By default the plugin ships with this config file:
# ServerSwap configuration - list your target servers here
# The plugin will create permissions for each entry automatically:
# serverswap.use.<server>
# serverswap.use.others.<server>
# You can also grant the wildcard permissions:
# serverswap.use.*
# serverswap.use.others.*
servers:
Hub:
address: hub.example.com
port: 25565
Minigames:
address: minigames.example.com
port: 25565
autoRedirect:
play.example.com: Hub
pvp.example.com: Minigames
Let's break this down each property at a time. First up we have the servers block which is where you tell the plugin where to find each server, it will have an address and a port associated with it. In the default config file there is two servers configured one being called "Hub" which links to a server at hub.example.com on port 25565 (The default minecraft port).
Then we have the autoRedirect section, this is similar to Velocity's forced-hosts. In short if someone connects to your server by joining the hostname specified as the objects name (in this case being play.example.com) it will transfer them automatically to the corrisponding server such as Hub.
There are some default permisisons that the plugin creates and then there are dynamic permissions based off your config file. Let's start off by listing the static permissions:
serverswap.use / serverswap.use.*: Allows the player to transfer them to any server specified within the config file. Default: True
serverswap.use.others / serverswap.use.others.*: Allows the executor to transfer other players to any server specified within the config file. Default: OP
serverswap.reload: Allows the user to simply reload the config file for the plugin and regenerate permissions based on it. Default: OP
Now as for the dynamic permissions:
serverswap.use.[serverName]: Allows the player to swap themselves to the specified server.
serverswap.use.others.[serverName]: Allows the exector to transfer other players to the server specified in the permission.
评论 0
登录后参与评分
还没有评论,来抢沙发吧