koishi-plugin-minecraft-command 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -0
- package/package.json +21 -3
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# koishi-plugin-minecraft-command
|
|
2
|
+
|
|
3
|
+
Koishi 的 Minecraft 服务器命令插件,通过聊天平台远程执行 Minecraft 服务器命令。需配合 [koishi-plugin-minecraft-adapter](https://github.com/johntime2005/koishi-plugin-minecraft-adapter) 使用。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- **在线玩家查询**: 查看服务器在线玩家列表
|
|
8
|
+
- **消息广播**: 在 Minecraft 服务器中广播消息
|
|
9
|
+
- **玩家传送**: 传送玩家到指定位置或其他玩家
|
|
10
|
+
- **物品给予**: 给予玩家指定物品
|
|
11
|
+
- **天气控制**: 设置服务器天气(晴天/雨天/雷暴)
|
|
12
|
+
- **时间控制**: 设置服务器时间(白天/黑夜/自定义游戏刻)
|
|
13
|
+
- **自定义命令**: 执行任意 Minecraft 服务器命令
|
|
14
|
+
- **权限管理**: 支持普通用户/管理员分级权限控制
|
|
15
|
+
- **中文别名**: 所有命令均支持中文别名
|
|
16
|
+
|
|
17
|
+
## 前置需求
|
|
18
|
+
|
|
19
|
+
- [Koishi](https://koishi.chat/) v4.17.9+
|
|
20
|
+
- [koishi-plugin-minecraft-adapter](https://github.com/johntime2005/koishi-plugin-minecraft-adapter) — Minecraft 适配器插件(必须先安装并配置好)
|
|
21
|
+
|
|
22
|
+
## 安装
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install koishi-plugin-minecraft-command
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 配置
|
|
29
|
+
|
|
30
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
31
|
+
|--------|------|--------|------|
|
|
32
|
+
| `botId` | `string` | `''` | 指定 Minecraft Bot ID(selfId),留空则自动选择第一个可用的 Minecraft Bot |
|
|
33
|
+
| `allowedChannels` | `string[]` | `[]` | 允许执行命令的频道/群组 ID 列表(留空则不限制频道) |
|
|
34
|
+
| `allowedUsers` | `string[]` | `[]` | 允许执行普通命令的用户 ID 列表(留空则不限制用户) |
|
|
35
|
+
| `adminUsers` | `string[]` | `[]` | 允许执行管理命令的用户 ID 列表 |
|
|
36
|
+
| `adminAuthority` | `number` | `3` | 管理命令所需的 Koishi authority 等级(与 `adminUsers` 为「或」关系,满足其一即可) |
|
|
37
|
+
| `userAuthority` | `number` | `1` | 普通命令所需的 Koishi authority 等级 |
|
|
38
|
+
|
|
39
|
+
### 配置示例
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
plugins:
|
|
43
|
+
minecraft-command:
|
|
44
|
+
botId: ''
|
|
45
|
+
allowedChannels: []
|
|
46
|
+
allowedUsers: []
|
|
47
|
+
adminUsers:
|
|
48
|
+
- '123456789'
|
|
49
|
+
adminAuthority: 3
|
|
50
|
+
userAuthority: 1
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 命令列表
|
|
54
|
+
|
|
55
|
+
### 普通命令
|
|
56
|
+
|
|
57
|
+
普通命令受 `allowedUsers` 和 `userAuthority` 控制。
|
|
58
|
+
|
|
59
|
+
| 命令 | 中文别名 | 说明 | 示例 |
|
|
60
|
+
|------|----------|------|------|
|
|
61
|
+
| `mc.list` | `mc.在线` | 查看在线玩家 | `mc.list` |
|
|
62
|
+
| `mc.say <消息>` | `mc.广播` | 在服务器中广播消息 | `mc.say 大家好` |
|
|
63
|
+
|
|
64
|
+
### 管理命令
|
|
65
|
+
|
|
66
|
+
管理命令受 `adminUsers` 和 `adminAuthority` 控制(满足其一即可)。
|
|
67
|
+
|
|
68
|
+
| 命令 | 中文别名 | 说明 | 示例 |
|
|
69
|
+
|------|----------|------|------|
|
|
70
|
+
| `mc.tp <玩家> <目标>` | `mc.传送` | 传送玩家到目标位置或玩家 | `mc.tp Steve Alex`<br>`mc.tp Steve 100 64 200` |
|
|
71
|
+
| `mc.give <玩家> <物品> [数量]` | `mc.给予` | 给予玩家物品 | `mc.give Steve diamond 64` |
|
|
72
|
+
| `mc.weather <类型>` | `mc.天气` | 设置服务器天气 | `mc.weather clear` |
|
|
73
|
+
| `mc.time <值>` | `mc.时间` | 设置服务器时间 | `mc.time day`<br>`mc.time 6000` |
|
|
74
|
+
| `mc.cmd <命令>` | `mc.命令` | 执行任意服务器命令 | `mc.cmd op Steve` |
|
|
75
|
+
|
|
76
|
+
### 天气类型
|
|
77
|
+
|
|
78
|
+
| 值 | 说明 |
|
|
79
|
+
|----|------|
|
|
80
|
+
| `clear` | 晴天 |
|
|
81
|
+
| `rain` | 雨天 |
|
|
82
|
+
| `thunder` | 雷暴 |
|
|
83
|
+
|
|
84
|
+
### 时间值
|
|
85
|
+
|
|
86
|
+
| 值 | 说明 |
|
|
87
|
+
|----|------|
|
|
88
|
+
| `day` | 白天 |
|
|
89
|
+
| `night` | 黑夜 |
|
|
90
|
+
| `noon` | 正午 |
|
|
91
|
+
| `midnight` | 午夜 |
|
|
92
|
+
| 数字 | 游戏刻(如 `6000`) |
|
|
93
|
+
|
|
94
|
+
## 权限说明
|
|
95
|
+
|
|
96
|
+
本插件采用两级权限模型:
|
|
97
|
+
|
|
98
|
+
### 普通权限
|
|
99
|
+
|
|
100
|
+
控制 `mc.list`、`mc.say` 命令的访问。
|
|
101
|
+
|
|
102
|
+
1. **频道限制** (`allowedChannels`):非空时,仅允许列表中的频道执行命令
|
|
103
|
+
2. **用户限制** (`allowedUsers`):非空时,用户需在列表中 **或** authority >= `userAuthority`
|
|
104
|
+
|
|
105
|
+
### 管理权限
|
|
106
|
+
|
|
107
|
+
控制 `mc.tp`、`mc.give`、`mc.weather`、`mc.time`、`mc.cmd` 命令的访问。
|
|
108
|
+
|
|
109
|
+
1. **频道限制** (`allowedChannels`):同普通权限
|
|
110
|
+
2. **管理员验证**:用户在 `adminUsers` 列表中 **或** authority >= `adminAuthority`(满足其一即可)
|
|
111
|
+
|
|
112
|
+
### 推荐配置
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
# 仅限特定群组使用,指定管理员
|
|
116
|
+
minecraft-command:
|
|
117
|
+
allowedChannels:
|
|
118
|
+
- '群组ID'
|
|
119
|
+
adminUsers:
|
|
120
|
+
- '管理员QQ号'
|
|
121
|
+
adminAuthority: 3
|
|
122
|
+
userAuthority: 1
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 相关项目
|
|
126
|
+
|
|
127
|
+
- [koishi-plugin-minecraft-adapter](https://github.com/johntime2005/koishi-plugin-minecraft-adapter) — Minecraft 适配器插件(本插件的前置依赖)
|
|
128
|
+
- [鹊桥 (QueQiao)](https://github.com/17TheWord/QueQiao) — Minecraft 服务端通信插件/Mod
|
|
129
|
+
- [Koishi](https://koishi.chat/) — 跨平台聊天机器人框架
|
|
130
|
+
|
|
131
|
+
## 链接
|
|
132
|
+
|
|
133
|
+
- [GitHub 仓库](https://github.com/johntime2005/koishi-plugin-minecraft-command)
|
|
134
|
+
- [问题反馈](https://github.com/johntime2005/koishi-plugin-minecraft-command/issues)
|
|
135
|
+
- [npm 包](https://www.npmjs.com/package/koishi-plugin-minecraft-command)
|
|
136
|
+
|
|
137
|
+
## 许可证
|
|
138
|
+
|
|
139
|
+
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-minecraft-command",
|
|
3
3
|
"description": "Execute Minecraft server commands from chat platforms via koishi-plugin-minecraft-adapter",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
|
-
"lib"
|
|
8
|
+
"lib",
|
|
9
|
+
"README.md"
|
|
9
10
|
],
|
|
10
11
|
"license": "MIT",
|
|
11
12
|
"author": "johntime2005",
|
|
13
|
+
"homepage": "https://github.com/johntime2005/koishi-plugin-minecraft-command",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/johntime2005/koishi-plugin-minecraft-command.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/johntime2005/koishi-plugin-minecraft-command/issues"
|
|
20
|
+
},
|
|
12
21
|
"scripts": {
|
|
13
22
|
"build": "tsc",
|
|
14
23
|
"prepublishOnly": "npm run build"
|
|
@@ -31,12 +40,21 @@
|
|
|
31
40
|
"command",
|
|
32
41
|
"rcon",
|
|
33
42
|
"mc",
|
|
34
|
-
"game"
|
|
43
|
+
"game",
|
|
44
|
+
"server",
|
|
45
|
+
"管理",
|
|
46
|
+
"queqiao",
|
|
47
|
+
"鹊桥"
|
|
35
48
|
],
|
|
36
49
|
"koishi": {
|
|
37
50
|
"description": {
|
|
38
51
|
"en": "Execute Minecraft server commands from chat platforms, works with minecraft-adapter",
|
|
39
52
|
"zh": "通过聊天平台执行 Minecraft 服务器命令,与 minecraft-adapter 联动"
|
|
53
|
+
},
|
|
54
|
+
"service": {
|
|
55
|
+
"required": [
|
|
56
|
+
"adapter"
|
|
57
|
+
]
|
|
40
58
|
}
|
|
41
59
|
}
|
|
42
60
|
}
|