From e8ef887b818051cd1bc054dd0ab409942f940d82 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Fri, 17 Oct 2025 13:31:32 +0800 Subject: [PATCH 1/4] fix: correct package name (1/2) --- .../huHoBot/Command/HuHoBotCommand.java | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/main/java/cn/huohuas001/huHoBot/Command/HuHoBotCommand.java diff --git a/src/main/java/cn/huohuas001/huHoBot/Command/HuHoBotCommand.java b/src/main/java/cn/huohuas001/huHoBot/Command/HuHoBotCommand.java deleted file mode 100644 index ed2cc79..0000000 --- a/src/main/java/cn/huohuas001/huHoBot/Command/HuHoBotCommand.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.huohuas001.huhobot.command; - -import cn.huohuas001.huhobot.HuHoBot; -import cn.huohuas001.huhobot.websocket.handler.BindRequest; -import org.allaymc.api.command.Command; -import org.allaymc.api.command.tree.CommandTree; -import org.allaymc.api.permission.PermissionGroups; -import org.allaymc.api.utils.TextFormat; - -public class HuHoBotCommand extends Command { - public HuHoBotCommand() { - super("huhobot", "HuHoBot's control command"); - getPermissions().forEach(PermissionGroups.OPERATOR::addPermission); - } - - @Override - public void prepareCommandTree(CommandTree tree) { - tree.getRoot() - .key("reconnect") - .exec(context -> { - if (HuHoBot.getInstance().reconnect()) { - context.addOutput(TextFormat.GOLD + "重连机器人成功."); - } else { - context.addOutput(TextFormat.DARK_RED + "重连机器人失败:已在连接状态."); - } - - return context.success(); - }) - .root() - .key("disconnect") - .exec(context -> { - if (HuHoBot.getInstance().disConnectServer()) { - context.addOutput(TextFormat.GOLD + "已断开机器人连接."); - } - return context.success(); - }) - .root() - .key("bind") - .str("code") - .exec(context -> { - String Code = context.getResult(1); - BindRequest obj = HuHoBot.getInstance().getBindRequest(); - if (obj.confirmBind(Code)) { - context.addOutput(TextFormat.GOLD + "已向服务器发送确认绑定请求,请等待服务端下发配置文件."); - } else { - context.addOutput(TextFormat.DARK_RED + "绑定码错误,请重新输入."); - } - return context.success(); - }) - .root() - .key("help") - .exec(context -> { - context.addOutput(TextFormat.AQUA + "HuHoBot 操作相关命令"); - context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot reconnect - 重新连接服务器"); - context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot disconnect - 断开服务器连接"); - context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot reload - 重载配置文件"); - context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot bind - 确认绑定"); - return context.success(); - }) - .root() - .key("reload") - .exec(context -> { - HuHoBot.reloadConfig(); - context.addOutput(TextFormat.GOLD + "已重载配置文件."); - return context.success(); - }) - .root() - .key("test") - .exec(ctx -> { - HuHoBot.getInstance().runCommand("version", ""); - return ctx.success(); - }); - - } -} \ No newline at end of file From b304cb3608662fb9cc4605cae10a2e5e2cf083c9 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Fri, 17 Oct 2025 13:31:51 +0800 Subject: [PATCH 2/4] fix: correct package name (2/2) --- .../huHoBot/command/HuHoBotCommand.java | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/main/java/cn/huohuas001/huHoBot/command/HuHoBotCommand.java diff --git a/src/main/java/cn/huohuas001/huHoBot/command/HuHoBotCommand.java b/src/main/java/cn/huohuas001/huHoBot/command/HuHoBotCommand.java new file mode 100644 index 0000000..ed2cc79 --- /dev/null +++ b/src/main/java/cn/huohuas001/huHoBot/command/HuHoBotCommand.java @@ -0,0 +1,75 @@ +package cn.huohuas001.huhobot.command; + +import cn.huohuas001.huhobot.HuHoBot; +import cn.huohuas001.huhobot.websocket.handler.BindRequest; +import org.allaymc.api.command.Command; +import org.allaymc.api.command.tree.CommandTree; +import org.allaymc.api.permission.PermissionGroups; +import org.allaymc.api.utils.TextFormat; + +public class HuHoBotCommand extends Command { + public HuHoBotCommand() { + super("huhobot", "HuHoBot's control command"); + getPermissions().forEach(PermissionGroups.OPERATOR::addPermission); + } + + @Override + public void prepareCommandTree(CommandTree tree) { + tree.getRoot() + .key("reconnect") + .exec(context -> { + if (HuHoBot.getInstance().reconnect()) { + context.addOutput(TextFormat.GOLD + "重连机器人成功."); + } else { + context.addOutput(TextFormat.DARK_RED + "重连机器人失败:已在连接状态."); + } + + return context.success(); + }) + .root() + .key("disconnect") + .exec(context -> { + if (HuHoBot.getInstance().disConnectServer()) { + context.addOutput(TextFormat.GOLD + "已断开机器人连接."); + } + return context.success(); + }) + .root() + .key("bind") + .str("code") + .exec(context -> { + String Code = context.getResult(1); + BindRequest obj = HuHoBot.getInstance().getBindRequest(); + if (obj.confirmBind(Code)) { + context.addOutput(TextFormat.GOLD + "已向服务器发送确认绑定请求,请等待服务端下发配置文件."); + } else { + context.addOutput(TextFormat.DARK_RED + "绑定码错误,请重新输入."); + } + return context.success(); + }) + .root() + .key("help") + .exec(context -> { + context.addOutput(TextFormat.AQUA + "HuHoBot 操作相关命令"); + context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot reconnect - 重新连接服务器"); + context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot disconnect - 断开服务器连接"); + context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot reload - 重载配置文件"); + context.addOutput(TextFormat.GOLD + ">" + TextFormat.DARK_GRAY + "/huhobot bind - 确认绑定"); + return context.success(); + }) + .root() + .key("reload") + .exec(context -> { + HuHoBot.reloadConfig(); + context.addOutput(TextFormat.GOLD + "已重载配置文件."); + return context.success(); + }) + .root() + .key("test") + .exec(ctx -> { + HuHoBot.getInstance().runCommand("version", ""); + return ctx.success(); + }); + + } +} \ No newline at end of file From 434ece6b198c14fae2ff61f4be4541d40c752a59 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Fri, 17 Oct 2025 13:35:49 +0800 Subject: [PATCH 3/4] fix: initialize config default values --- src/main/java/cn/huohuas001/huHoBot/HuHoBot.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/cn/huohuas001/huHoBot/HuHoBot.java b/src/main/java/cn/huohuas001/huHoBot/HuHoBot.java index 4e79091..e46aedd 100644 --- a/src/main/java/cn/huohuas001/huHoBot/HuHoBot.java +++ b/src/main/java/cn/huohuas001/huHoBot/HuHoBot.java @@ -64,6 +64,10 @@ public void onLoad() { } ); + // 初始化默认值 + config.initializeDefaults(); + config.save(); + //注册命令 Registries.COMMANDS.register(new HuHoBotCommand()); From d27214f7adcfa82f5458c3f9ffbf99b93b9449e3 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Fri, 17 Oct 2025 13:36:36 +0800 Subject: [PATCH 4/4] feat: bump version to 0.1.1 --- build.gradle.kts | 2 +- src/main/resources/plugin.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 9ddfc7f..b551023 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { group = "cn.huohuas001.huhobot" description = "HuHoBot Allay Adapter" -version = "0.1.0" +version = "0.1.1" java { toolchain { diff --git a/src/main/resources/plugin.json b/src/main/resources/plugin.json index e9cd459..5cc1fdb 100644 --- a/src/main/resources/plugin.json +++ b/src/main/resources/plugin.json @@ -2,6 +2,6 @@ "entrance": "cn.huohuas001.huhobot.HuHoBot", "name": "HuHoBot", "authors": ["HuoHuas001"], - "version": "0.1.0", + "version": "0.1.1", "api_version": ">=0.14.0" } \ No newline at end of file