LostCrafters 服务器插件
一个 Velocity 插件,提供可自定义的 /server 命令,支持服务器分组、GUI(通过 Protocolize)以及基于文本的选择方式。
功能
- 服务器分组:定义服务器组。玩家只能看到其当前所在组内的服务器。
- GUI 支持:使用 Protocolize 显示用于选择服务器的交互式物品栏。
- 基于文本的选择:如果禁用了 GUI,则回退为聊天中的可点击消息。
- 可自定义的消息:所有消息均支持 MiniMessage 格式,并可在配置文件中完全自定义。
- LuckPerms 集成:细粒度的权限控制。
- MiniPlaceholders 支持:与 MiniPlaceholders 集成,以获取来自其他插件的动态占位符。
命令
/server [server]:打开服务器选择 GUI/菜单,或直接连接到指定的服务器。
/lcserver reload:重新加载插件配置。
权限
lostcrafters.server.use:允许使用 /server 命令。
lostcrafters.server.reload:允许使用 /lcserver reload 命令。
lostcrafters.serveraccess.<server>:授予连接到特定服务器的权限,其中 <server> 是 Velocity 内部服务器名称。
lostcrafters.serveraccess.*:授予访问所有服务器的权限。
注意:默认情况下,玩家无权访问任何服务器。您必须通过这些权限显式授予访问权。
如果玩家在连接到某个服务器时被撤销了相应权限,他们将被自动重定向到备用服务器(在 velocity.toml 中定义),或者如果没有可用的备用服务器则被断开连接。
配置
配置文件位于 plugins/lostcrafters/server/config.yml。
示例配置
注意:对于 GUI 物品,建议使用原版 Minecraft ID(例如 minecraft:compass)。模组物品可能不受 GUI 库支持,如果找不到则会默认为钻石剑。
server-groups:
survival_group:
name: "<green>Survival Group</green>"
show-gui: true
enable-switch-broadcast: true
servers:
- lobby:
name: "Lobby"
item: "minecraft:compass"
- survival:
name: "Survival"
item: "minecraft:iron_pickaxe"
- creative:
name: "Creative"
item: "minecraft:grass_block"
- staff_lounge:
name: "Staff Lounge"
hide-from-list: true
minigames_group:
name: "<yellow>Minigames Group</yellow>"
show-gui: false
servers:
- minigames_lobby:
name: "Minigames Lobby"
item: "minecraft:clock"
配置详解
服务器分组
server-groups 下的每个条目定义了一组服务器。
name: (String) 组的显示名称。支持 MiniMessage。
show-gui: (Boolean) 如果为 true,在使用 /server 时将显示 GUI(箱子菜单)。如果为 false,将在聊天中发送基于文本的选择消息。
enable-switch-broadcast: (Boolean, 可选, 默认值: true) 如果为 true,当玩家从组内的一个服务器切换到另一个服务器时,将向该组内所有玩家广播一条消息。
服务器条目
组内的每个服务器由其内部的 Velocity 名称及以下属性定义:
name: (String) 服务器的显示名称。
item: (String, 可选, 默认值: minecraft:diamond_sword) GUI 表示所用的 Minecraft 物品 ID(例如 minecraft:compass)。
hide-from-list: (Boolean, 可选, 默认值: false) 如果为 true,此服务器将从 GUI 和文本选择列表中隐藏。如果玩家拥有相应权限,仍可通过 /server <name> 访问。这对于不想在通用列表中宣传的服务器(如 limbo 大厅或仅限员工使用的区域)非常有用。
消息配置
您可以在配置的 messages 部分自定义所有插件消息。以下占位符根据指示在每个消息中有效且可用:
%servername%:在 server-groups 中配置的服务器显示名称。
%playercount%:该服务器上当前在线的玩家数量。
%players%:当前在该服务器上的玩家名称列表,以逗号分隔。
%server%:服务器的内部 ID/名称。
%player%:正在切换服务器的玩家名称。
%previousserver%:前一个服务器的内部 ID。
%previousservername%:前一个服务器的显示名称。
各消息的有效占位符:
| 消息 |
默认消息 |
有效占位符 |
select-server |
<yellow>Select a server: </yellow> |
(无) |
server-format |
[<green>%servername%</green>] |
%servername%, %playercount%, %players% |
current-server-format |
[<gray>%servername%</gray>] |
%servername%, %playercount%, %players% |
hover-text |
<aqua>%servername%</aqua><newline><white>Players (%playercount%): %players%</white> |
%servername%, %playercount%, %players% |
no-permission |
<red>You do not have permission to use this command.</red> |
(无) |
reloaded |
<green>Configuration reloaded.</green> |
(无) |
server-not-found |
<red>Server %server% not found.</red> |
%server% |
already-connected |
<red>You are already connected to %servername%.</red> |
%server%, %servername% |
connecting |
<green>Connecting to %servername%...</green> |
%server%, %servername% |
no-server-permission |
<red>You do not have permission to connect to %servername%.</red> |
%server%, %servername% |
no-fallback-server |
<red>You no longer have permission to be on this server and no fallback server is available.</red> |
(无) |
server-switch-broadcast |
<gray>%player% has switched from %previousservername% to %servername%</gray> |
%player%, %server%, %servername%, %previousserver%, %previousservername% |
hover-text 中的示例用法:
hover-text: "<aqua>%servername%</aqua><newline><white>玩家 (%playercount%): %players%</white>"
依赖项
- Velocity API: 3.4.0-SNAPSHOT
- Protocolize: 2.4.1(可选,用于 GUI)
- MiniPlaceholders:(可选,用于额外的占位符)
- LuckPerms:用于权限管理
- Configurate (YAML):用于配置管理
LostCrafters Server Plugin
A Velocity plugin that provides a customizable /server command with support for server groups, GUIs (via Protocolize), and text-based selection.
Features
- Server Groups: Define groups of servers. Players only see servers within their current group.
- GUI Support: Use Protocolize to show an interactive inventory for server selection.
- Text-based Selection: Fallback to clickable chat messages if GUIs are disabled.
- Customizable Messages: All messages support MiniMessage and can be fully customized in the config.
- LuckPerms Integration: Fine-grained permission control.
- MiniPlaceholders Support: Integration with MiniPlaceholders for dynamic placeholders from other plugins.
Commands
/server [server]: Opens the server selection GUI/menu or connects directly to the specified server.
/lcserver reload: Reloads the plugin configuration.
Permissions
lostcrafters.server.use: Allows use of the /server command.
lostcrafters.server.reload: Allows use of the /lcserver reload command.
lostcrafters.serveraccess.<server>: Grants access to connect to a specific server, where <server> is the internal Velocity server name.
lostcrafters.serveraccess.*: Grants access to all servers.
Note: By default, players have no access to any server. You must explicitly grant access via these permissions.
If a player's permission is revoked while they are connected to a server, they will be automatically redirected to a fallback server (as defined in velocity.toml) or disconnected if no fallback is available.
Configuration
The configuration is located at plugins/lostcrafters/server/config.yml.
Example Configuration
Note: For GUI items, it is recommended to use vanilla Minecraft IDs (e.g., minecraft:compass). Modded items may not be supported by the GUI library and will default to a diamond sword if not found.
server-groups:
survival_group:
name: "<green>Survival Group</green>"
show-gui: true
enable-switch-broadcast: true
servers:
- lobby:
name: "Lobby"
item: "minecraft:compass"
- survival:
name: "Survival"
item: "minecraft:iron_pickaxe"
- creative:
name: "Creative"
item: "minecraft:grass_block"
- staff_lounge:
name: "Staff Lounge"
hide-from-list: true
minigames_group:
name: "<yellow>Minigames Group</yellow>"
show-gui: false
servers:
- minigames_lobby:
name: "Minigames Lobby"
item: "minecraft:clock"
Configuration Breakdown
Server Groups
Each entry under server-groups defines a collection of servers.
name: (String) The display name of the group. Supports MiniMessage.
show-gui: (Boolean) If true, a GUI (chest menu) will be shown when using /server. If false, a text-based selection message will be sent in chat.
enable-switch-broadcast: (Boolean, Optional, Default: true) If true, a message will be broadcast to all players within the group when a player switches from one server in the group to another.
Server Entries
Each server within a group is defined by its internal Velocity name and the following properties:
name: (String) The display name of the server.
item: (String, Optional, Default: minecraft:diamond_sword) The Minecraft item ID for the GUI representation (e.g., minecraft:compass).
hide-from-list: (Boolean, Optional, Default: false) If true, this server will be hidden from the GUI and the text selection list. The server remains accessible via /server <name> if the player has the appropriate permission. This is useful for servers like limbo lobbies or staff-only areas that you don't want to advertise in the general list.
Message Configuration
You can customize all plugin messages in the messages section of the config. The following placeholders are available and valid per message as indicated:
%servername%: The display name of the server as configured in server-groups.
%playercount%: The current number of players online on that server.
%players%: A comma-separated list of names of players currently on that server.
%server%: The internal ID/name of the server.
%player%: The name of the player who is switching servers.
%previousserver%: The internal ID of the previous server.
%previousservername%: The display name of the previous server.
Valid Placeholders per Message:
| Message |
Default Message |
Valid Placeholders |
select-server |
<yellow>Select a server: </yellow> |
(none) |
server-format |
[<green>%servername%</green>] |
%servername%, %playercount%, %players% |
current-server-format |
[<gray>%servername%</gray>] |
%servername%, %playercount%, %players% |
hover-text |
<aqua>%servername%</aqua><newline><white>Players (%playercount%): %players%</white> |
%servername%, %playercount%, %players% |
no-permission |
<red>You do not have permission to use this command.</red> |
(none) |
reloaded |
<green>Configuration reloaded.</green> |
(none) |
server-not-found |
<red>Server %server% not found.</red> |
%server% |
already-connected |
<red>You are already connected to %servername%.</red> |
%server%, %servername% |
connecting |
<green>Connecting to %servername%...</green> |
%server%, %servername% |
no-server-permission |
<red>You do not have permission to connect to %servername%.</red> |
%server%, %servername% |
no-fallback-server |
<red>You no longer have permission to be on this server and no fallback server is available.</red> |
(none) |
server-switch-broadcast |
<gray>%player% has switched from %previousservername% to %servername%</gray> |
%player%, %server%, %servername%, %previousserver%, %previousservername% |
Example usage in hover-text:
hover-text: "<aqua>%servername%</aqua><newline><white>Players (%playercount%): %players%</white>"
Dependencies
- Velocity API: 3.4.0-SNAPSHOT
- Protocolize: 2.4.1 (Optional, required for GUIs)
- MiniPlaceholders: (Optional, for additional placeholders)
- LuckPerms: For permission management
- Configurate (YAML): For configuration management
评论 0
登录后参与评分
还没有评论,来抢沙发吧