⌨️ 按键绑定
将按键与服务端命令绑定。按下按键,服务器执行命令。
客户端模组 (Fabric) • 服务端插件 (Paper)
| 环境 | 加载器 | MC 版本 | 状态 |
|---|---|---|---|
| 客户端 | Fabric | 1.21.x, 26.x | 已发布 |
| 服务端 | Paper | 1.18.2+ | 已发布 |
| 客户端 | NeoForge | 1.21.x, 26.x | 已发布 |
| 客户端 | Forge | 1.21.x, 26.x | 已发布 |
注意:必须同时安装 服务端插件 和对应的 客户端模组,按键绑定才能正常工作。在没有安装该插件的服务器上,不会注册或提供任何按键绑定。
✨ 功能特性
- 🔗 服务端驱动:动作完全由服务端定义,并在玩家加入时同步到客户端。
- 📁 按服务器存储:按键分配信息保存在
.minecraft/config/keybind-servers/目录下,以服务器 IP 为单位区分,重新加入时不会被覆盖。 - 🛠️ 动态注册:新的服务端动作会出现在你的 设置 → 控制 菜单中,无需重启游戏。
- 💬 游戏内管理器:在 Paper 1.21.7+ 上,输入
/kbind manage可打开 Minecraft 对话框来添加、编辑或删除按键绑定,无需修改config.yml。点击 Press a key…(按下某个键…),然后按下你选择的按键(需要安装客户端模组)。 - ⏱️ 双重冷却时间:包含全局冷却时间(任意动作之间)和每个动作独立的冷却时间,防止滥用。
- 📊 bStats 指标:提供完全匿名的服务器遥测数据,帮助追踪插件的使用情况和普及度。
- 🔐 权限支持:除了默认的
keybind.use权限外,每个动作都支持可选的额外权限节点。
🚀 工作原理
- 同步:玩家加入后 1 秒,插件通过
keybind:sync频道发送所有配置好的动作(名称、显示名称、默认按键)。 - 注册:模组将每个动作注册为 Minecraft 原生按键绑定,归类于 设置 → 控制 中的 Keybind 类别下。
- 触发:当按下按键且未打开任何屏幕界面时,模组通过
keybind:main频道发送动作名称。 - 执行:插件验证动作名称(仅允许字母数字和下划线),检查权限和冷却时间,然后执行相应的命令。
🛠️ 安装指南
服务端
- 将
Keybind-Plugin-1.0.4.jar放入你的plugins/文件夹。 - 重启服务器 ——
plugins/Keybind/config.yml会自动生成。 - 编辑
config.yml定义你的动作,然后运行/kbind reload。
客户端
- 根据 Minecraft 版本和加载器,将对应的客户端 jar 包安装到
.minecraft/mods/目录。 - 安装所选平台所需的加载器和 API。Minecraft 1.21.x 请使用 Java 21,Minecraft 26.x 请使用 Java 25。
- 不要同时安装多个 Keybind 客户端 jar 包。启动游戏并连接到运行了 Keybind 插件的服务器。
⚙️ 配置说明
plugins/Keybind/config.yml
# 更新检查器(检查 GitHub Releases 并在玩家加入时通知管理员)
update-checker: true
# 任意按键绑定动作之间的全局冷却时间(毫秒)
global-cooldown: 500
actions:
spawn:
command: "spawn" # 要执行的命令(不含 /)
display-name: "Spawn" # 在“控制”菜单中显示的标签
default-key: "LEFT_BRACKET" # 首次连接玩家的建议按键
permission: "" # 可选的额外权限节点(留空表示无)
cooldown: 1000 # 单个动作的冷却时间(毫秒);默认为 global-cooldown
console: false # true = 以控制台身份执行,并将 {player} 替换为玩家名字
home:
command: "home"
display-name: "Home"
default-key: "RIGHT_BRACKET"
permission: ""
cooldown: 1000
console: false
# 启用匿名指标报告(bStats)
metrics: true
备注:
- 动作名称只能包含字母、数字和下划线(例如
my_action)。 console: true会以控制台发送者的身份执行命令。使用{player}作为玩家名字的占位符(例如command: "tp {player} spawn")。default-key仅在玩家第一次连接时应用。随后的加入将使用其保存的按键绑定。
⌨️ 支持的按键
键盘
| 类别 | 值 |
|---|---|
| 字母 | A–Z |
| 数字 | 0–9 |
| 功能键 | F1–F25 |
| 方向键 | UP, DOWN, LEFT, RIGHT |
| 导航键 | PAGE_UP, PAGE_DOWN, HOME, END, INSERT, DELETE |
| 特殊键 | SPACE, ENTER, TAB, BACKSPACE, ESCAPE, PAUSE |
| 锁定键 | CAPS_LOCK, SCROLL_LOCK, NUM_LOCK |
| 其他键 | PRINT_SCREEN, MENU |
| 修饰键 | LEFT_SHIFT, LEFT_CONTROL (或 LEFT_CTRL), LEFT_ALT, LEFT_SUPER, RIGHT_SHIFT, RIGHT_CONTROL (或 RIGHT_CTRL), RIGHT_ALT, RIGHT_SUPER |
| 小键盘 | KP_0–KP_9, KP_ADD, KP_SUBTRACT, KP_MULTIPLY, KP_DIVIDE, KP_DECIMAL, KP_ENTER, KP_EQUAL |
| 符号键 | LEFT_BRACKET, RIGHT_BRACKET, BACKSLASH, SEMICOLON, APOSTROPHE, COMMA, PERIOD, SLASH, GRAVE_ACCENT, MINUS, EQUAL — 或直接使用字符:[, ], \, ;, ', ,, ., /, `, -, = |
| 世界键 | WORLD_1, WORLD_2(某些键盘上的区域特定键) |
鼠标
| 值 | 别名 | 按钮 |
|---|---|---|
MOUSE_LEFT |
MOUSE_1 |
左键单击 |
MOUSE_RIGHT |
MOUSE_2 |
右键单击 |
MOUSE_MIDDLE |
MOUSE_3 |
中键单击 |
MOUSE_4–MOUSE_8 |
— | 侧键/额外按键 |
📜 命令与权限
| 命令 | 描述 | 权限 |
|---|---|---|
/kbind <action> |
手动触发一个动作 | keybind.use |
/kbind list |
列出所有已配置的动作名称 | (任意) |
/kbind manage |
打开 Minecraft 对话框管理器(Paper 1.21.7+) | keybind.admin |
/kbind add <name> <command...> |
创建快捷键 | keybind.admin |
/kbind set <name> <field> <value> |
编辑 command、display、key、permission、cooldown 或 console |
keybind.admin |
/kbind remove <name> |
删除快捷键 | keybind.admin |
/kbind reload |
重新加载配置并同步所有在线玩家 | keybind.admin |
| 权限 | 描述 | 默认值 |
|---|---|---|
keybind.use |
触发任何动作所需 | true (所有人) |
keybind.admin |
访问 /kbind manage、添加/设置/删除以及重载的权限 |
op |
keybind.bypass.cooldown |
忽略所有冷却时间 | op |
⌨️ Keybind
Bind keys to server-side commands. Press a key, the server runs a command.
Client Mod (Fabric) • Server Plugin (Paper)
| Environment | Loader | MC Version | Status |
|---|---|---|---|
| Client | Fabric | 1.21.x, 26.x | Released |
| Server | Paper | 1.18.2+ | Released |
| Client | NeoForge | 1.21.x, 26.x | Released |
| Client | Forge | 1.21.x, 26.x | Released |
Note: Both the Server Plugin and the matching Client Mod must be installed for keybinds to function. On servers without the plugin, no keybinds will be registered or available.
✨ Features
- 🔗 Server-Driven: Actions are defined entirely on the server and synced to the client on join.
- 📁 Per-Server Storage: Key assignments are saved per server IP in
.minecraft/config/keybind-servers/and never overwritten on rejoin. - 🛠️ Dynamic Registration: New server actions appear in your Settings → Controls menu without restarting the game.
- 💬 In-game Manager: On Paper 1.21.7+,
/kbind manageopens a Minecraft dialog to add, edit, or delete keybinds without touchingconfig.yml. Click Press a key…, then press the key (client mod required). - ⏱️ Dual Cooldowns: Both a global cooldown (between any actions) and per-action cooldowns prevent spam.
- 📊 bStats Metrics: Fully anonymous server telemetry to help track plugin usage and adoption.
- 🔐 Permission Support: Each action supports an optional extra permission node on top of
keybind.use.
🚀 How It Works
- Sync: 1 second after a player joins, the plugin sends all configured actions (name, display name, default key) over the
keybind:syncchannel. - Registration: The mod registers each action as a native Minecraft keybind under the Keybind category in Settings → Controls.
- Trigger: When a key is pressed (and no screen is open), the mod sends the action name over the
keybind:mainchannel. - Execution: The plugin validates the action name (alphanumeric + underscores only), checks permissions and cooldowns, then runs the command.
🛠️ Installation
Server Side
- Place
Keybind-Plugin-1.0.4.jarinto yourplugins/folder. - Restart the server —
plugins/Keybind/config.ymlis generated automatically. - Edit
config.ymlto define your actions, then run/kbind reload.
Client Side
- Install the client jar matching your Minecraft version and loader into
.minecraft/mods/ - Install the required loader and API for the selected platform. Use Java 21 for Minecraft 1.21.x, and Java 25 for Minecraft 26.x.
- Do not install multiple Keybind client jars at the same time. Launch the game and connect to a server running the Keybind plugin.
⚙️ Configuration
plugins/Keybind/config.yml
# Update Checker (checks GitHub releases and notifies admins on join)
update-checker: true
# Global cooldown between any keybind actions (milliseconds)
global-cooldown: 500
actions:
spawn:
command: "spawn" # Command to run (without /)
display-name: "Spawn" # Label shown in Controls menu
default-key: "LEFT_BRACKET" # Suggested key for first-time players
permission: "" # Optional extra permission node (leave empty for none)
cooldown: 1000 # Per-action cooldown (ms); defaults to global-cooldown
console: false # true = run as console with {player} replaced by player name
home:
command: "home"
display-name: "Home"
default-key: "RIGHT_BRACKET"
permission: ""
cooldown: 1000
console: false
# Enable anonymous metrics reporting (bStats)
metrics: true
Notes:
- Action names must be alphanumeric + underscores only (e.g.
my_action). console: trueruns the command as the console sender. Use{player}as a placeholder for the player's name (e.g.command: "tp {player} spawn").default-keyis only applied the first time a player connects. Their saved binding is used on subsequent joins.
⌨️ Supported Keys
Keyboard
| Category | Values |
|---|---|
| Letters | A–Z |
| Numbers | 0–9 |
| Function | F1–F25 |
| Arrows | UP, DOWN, LEFT, RIGHT |
| Navigation | PAGE_UP, PAGE_DOWN, HOME, END, INSERT, DELETE |
| Special | SPACE, ENTER, TAB, BACKSPACE, ESCAPE, PAUSE |
| Lock keys | CAPS_LOCK, SCROLL_LOCK, NUM_LOCK |
| Other | PRINT_SCREEN, MENU |
| Modifiers | LEFT_SHIFT, LEFT_CONTROL (or LEFT_CTRL), LEFT_ALT, LEFT_SUPER, RIGHT_SHIFT, RIGHT_CONTROL (or RIGHT_CTRL), RIGHT_ALT, RIGHT_SUPER |
| Numpad | KP_0–KP_9, KP_ADD, KP_SUBTRACT, KP_MULTIPLY, KP_DIVIDE, KP_DECIMAL, KP_ENTER, KP_EQUAL |
| Symbols | LEFT_BRACKET, RIGHT_BRACKET, BACKSLASH, SEMICOLON, APOSTROPHE, COMMA, PERIOD, SLASH, GRAVE_ACCENT, MINUS, EQUAL — or the character directly: [, ], \, ;, ', ,, ., /, `, -, = |
| World keys | WORLD_1, WORLD_2 (locale-specific keys on some keyboards) |
Mouse
| Value | Aliases | Button |
|---|---|---|
MOUSE_LEFT |
MOUSE_1 |
Left click |
MOUSE_RIGHT |
MOUSE_2 |
Right click |
MOUSE_MIDDLE |
MOUSE_3 |
Middle click |
MOUSE_4–MOUSE_8 |
— | Side/extra buttons |
📜 Commands & Permissions
| Command | Description | Permission |
|---|---|---|
/kbind <action> |
Manually trigger an action | keybind.use |
/kbind list |
List all configured action names | (any) |
/kbind manage |
Open the Minecraft dialog manager (Paper 1.21.7+) | keybind.admin |
/kbind add <name> <command...> |
Create a keybind | keybind.admin |
/kbind set <name> <field> <value> |
Edit command, display, key, permission, cooldown, or console |
keybind.admin |
/kbind remove <name> |
Delete a keybind | keybind.admin |
/kbind reload |
Reload config and re-sync all online players | keybind.admin |
| Permission | Description | Default |
|---|---|---|
keybind.use |
Required to trigger any action | true (everyone) |
keybind.admin |
Access to /kbind manage, add/set/remove, and reload |
op |
keybind.bypass.cooldown |
Ignore all cooldowns | op |
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Keybind
Quilt(新)
- 原生 Quilt 构建:为 Minecraft 1.21 和 26.x 提供专用的
quilt/模块——无需 Fabric API。 - 原版自定义载荷传输:通过编解码器注册 mixin、数据包监听器 mixin 以及用于 Paper/ViaVersion 兼容性的
minecraft:register频道公告实现。
修复与可靠性
- MC 26.3 崩溃:解决了在
InputConstants.Type.KEYSYM上出现的NoSuchFieldError(在 26.3 中已重命名为KEYBOARD),采用由所有加载器共享的反射式跨版本解析器。 - NeoForge/Forge Hello 重试机制:Hello 数据包仅在发送成功后标记为已发送;失败时会记录日志并重试,而不是被静默吞没。
- 重复同步消息:重复的同步数据包(早期加入重传)不再刷屏显示
[Keybind] Synced聊天信息——仅首次同步或操作发生变化时显示。 - 同步交付:服务器会在 Hello 后约 1 秒重新发送同步数据包(基于 Folia 安全的调度器),以覆盖早期加入导致的数据包丢失;仅向宣告了该模组的客户端发送同步数据。
- 控制类别顺序:按键绑定操作类别现在在所有加载器和版本的“设置 → 控制”界面中均显示在最顶部。
插件
- Folia 支持:通过反射式调度器兼容层,同步调度在 Paper 和 Folia 上均可正常工作。
- 兼容性门控:插件消息仅发送给发送过按键绑定 Hello 的玩家——原版客户端不会收到任何内容。
- 诊断日志:记录 Hello 接收和同步发送情况,便于故障排查。
- bStats:将指标 ID 更正为已注册的
Keybinds项目(34789)。
修复与可靠性
- 控制菜单重复问题:解决了按键绑定在 设置 → 控制 → 按键绑定 中显示两次并在
options.txt中重复的问题。用基于名称的去重和KeybindManager中的就地映射更新替换了冗余的静态注册。 - 自动设置去重:客户端选项映射会在初始化时自动扫描并删除重复条目。
- Forge 事件监听器清理:移除了 Forge 26 中冗余的
RegisterKeyMappingsEvent注册,转而依赖统一的动态注入以避免重复。 - 聊天格式与编码:将聊天同步和按键捕获覆盖层消息中的旧版
\u00a7格式代码替换为原生ChatFormatting文本组件,防止在 Windows 系统上出现A a[Keybind]乱码。 - Forge 26.1 运行时引导:解决了 Forge 26.1 上的启动器问题,该问题会导致选择未打补丁的原版 jar 文件而不是已打补丁的客户端二进制文件。
NeoForge(已发布)
- NeoForge 1.21.11:正式支持针对 NeoForge 21.11.48(Minecraft 1.21.11)。
- NeoForge 26.1 / 26.2:完全支持 Minecraft 26.x,包括自定义分类排序、有效载荷网络通信和客户端刻处理。
- NeoForge 1.21:稳定版本,针对 NeoForge 21.0.167。
插件
- 箱子 GUI 回退:添加了带有分页和点击音效的交互式 54 格箱子 GUI,适用于没有 Paper Dialog API 的服务器。
- 更新检查器:加入服务器时自动检查 GitHub 发行版并通知管理员。
- 指标统计:通过 bStats 进行匿名遥测。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
AE2:一款流行的自动化与存储模组
评论 0
登录后参与评分
还没有评论,来抢沙发吧