koishi-plugin-minecraft-search 1.3.0 → 1.3.2

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/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
8
  var __export = (target, all) => {
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -26,7 +36,10 @@ __export(src_exports, {
26
36
  });
27
37
  module.exports = __toCommonJS(src_exports);
28
38
  var import_koishi = require("koishi");
29
- var import_mc_server_util = require("mc-server-util");
39
+ var getMinecraftServerStatus;
40
+ import("mc-server-util").then((m) => {
41
+ getMinecraftServerStatus = m.getMinecraftServerStatus;
42
+ });
30
43
  var name = "minecraft-search";
31
44
  var Config = import_koishi.Schema.intersect([
32
45
  import_koishi.Schema.object({
@@ -93,6 +106,9 @@ function apply(ctx, config) {
93
106
  __name(minekuaiApiRequest, "minekuaiApiRequest");
94
107
  async function queryServerStatus(server) {
95
108
  try {
109
+ if (!getMinecraftServerStatus) {
110
+ throw new Error("mc-server-util 模块未正确加载");
111
+ }
96
112
  const defaultPort = server.serverType === "bedrock" ? 19132 : 25565;
97
113
  const { host, port } = parseServerAddress(server.host, defaultPort);
98
114
  const timeout = (server.timeout || 5) * 1e3;
@@ -100,7 +116,7 @@ function apply(ctx, config) {
100
116
  if (server.serverType === "bedrock") {
101
117
  throw new Error("Bedrock服务器暂不支持");
102
118
  } else {
103
- result = await (0, import_mc_server_util.getMinecraftServerStatus)(host, port, {
119
+ result = await getMinecraftServerStatus(host, port, {
104
120
  timeout,
105
121
  debug: false
106
122
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-minecraft-search",
3
3
  "description": "使用API查询基础的mc服务器信息",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -37,7 +37,6 @@ servers: [
37
37
  name: "主服务器", // 服务器名称
38
38
  host: "play.example.com:25565", // 服务器地址(支持带端口)
39
39
  serverType: "java", // 服务器类型:java/bedrock
40
- enableQuery: false, // 是否启用Query查询
41
40
  timeout: 5.0, // 查询超时时间(秒)
42
41
  minekuaiInstanceId: "xxx" // 麦块实例ID(可选,用于电源控制)
43
42
  }
@@ -62,17 +61,20 @@ minekuaiSettings: {
62
61
 
63
62
  **输出示例:**
64
63
  ```
65
- 📊 服务器状态汇总 (3台)
64
+ 📊 服务器状态汇总 (当前在线2/3台)
66
65
 
67
- 🟢 主服务器 - 在线 | 玩家: 15/50 | 版本: 1.20.1
68
- 🟢 生存服 - 在线 | 玩家: 8/30 | 版本: 1.19.4
69
- 🔴 创造服 - 离线
66
+ [ID:1] 🟢 主服务器 - 在线 | 玩家: 15/50 | 版本: 1.20.1
67
+ [ID:2] 🟢 生存服 - 在线 | 玩家: 8/30 | 版本: 1.19.4
68
+ [ID:3] 🔴 创造服 - 离线
69
+
70
+ 💡 输入"查服+服务器ID"即可查询详细状态,例如:查服 1
70
71
  ```
71
72
 
72
73
  ### 服务器电源控制
73
74
  ```
74
75
  开服 1 # 启动ID为1的麦块服务器
75
76
  重启 1 # 重启ID为1的麦块服务器
77
+ 强制重启 1 # 强制重启ID为1的麦块服务器
76
78
  ```
77
79
 
78
80
  ## 配置选项说明