From 4788fa81a49b2caac1fe4ffe2568e30c56a6dc57 Mon Sep 17 00:00:00 2001 From: cnlimiter Date: Mon, 11 Mar 2024 13:19:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(fabric):=20=E5=91=9C=E5=91=9C=EF=BC=8C?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BA=86=E4=B8=A4=E9=81=8DListener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fabric/gradle.properties | 2 +- .../main/java/cn/evole/mods/mcbot/McBot.java | 3 +- .../evole/mods/mcbot/util/MessageThread.java | 44 ------------------- 3 files changed, 2 insertions(+), 47 deletions(-) delete mode 100644 fabric/src/main/java/cn/evole/mods/mcbot/util/MessageThread.java diff --git a/fabric/gradle.properties b/fabric/gradle.properties index e353940..f44f406 100644 --- a/fabric/gradle.properties +++ b/fabric/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx8G # Mod Properties -mod_version=2.2.0.1 +mod_version=2.2.1.1 maven_group=cn.evole.mods archives_base_name=McBot-fabric diff --git a/fabric/src/main/java/cn/evole/mods/mcbot/McBot.java b/fabric/src/main/java/cn/evole/mods/mcbot/McBot.java index f768c6f..8f65a32 100644 --- a/fabric/src/main/java/cn/evole/mods/mcbot/McBot.java +++ b/fabric/src/main/java/cn/evole/mods/mcbot/McBot.java @@ -89,7 +89,6 @@ public void onServerStarted(MinecraftServer server) { if (ModConfig.INSTANCE.getCommon().isAutoOpen()) { onebot = OneBotClient.create(ModConfig.INSTANCE.getBotConfig().build()).open().registerEvents(new IBotEvent()); } - if (onebot != null) onebot.getEventsBus().register(new IBotEvent()); CustomCmdHandler.INSTANCE.load();//自定义命令加载 CQUtilsExecutor = Executors.newSingleThreadExecutor(); // 创建CQ码处理线程池 } @@ -103,8 +102,8 @@ public void onServerStopping(MinecraftServer server) { } public void onServerStopped(MinecraftServer server) { - if (onebot != null) onebot.close(); CQUtilsExecutor.shutdownNow(); + if (onebot != null) onebot.close(); } } diff --git a/fabric/src/main/java/cn/evole/mods/mcbot/util/MessageThread.java b/fabric/src/main/java/cn/evole/mods/mcbot/util/MessageThread.java deleted file mode 100644 index 51fb7e5..0000000 --- a/fabric/src/main/java/cn/evole/mods/mcbot/util/MessageThread.java +++ /dev/null @@ -1,44 +0,0 @@ -//package cn.evole.mods.mcbot.util; -// -//import cn.evole.mods.mcbot.Const; -//import cn.evole.mods.mcbot.McBot; -//import com.google.gson.JsonArray; -//import java.util.concurrent.ExecutorService; -//import java.util.concurrent.Executors; -// -///** -// * @Project: McBot-fabric -// * @Author: xia-mc -// * @CreateTime: 2024/2/12 16:11 -// * @Description: -// */ -//public class MessageThread { -// private final ExecutorService executor; -// public MessageThread() { -// executor = Executors.newCachedThreadPool(); -// } -// -// public void submit(long groupId, String msg, boolean autoEscape) { -// Const.LOGGER.debug(String.format("转发游戏消息: %s", msg)); -// executor.submit(() -> McBot.bot.sendGroupMsg(groupId, msg, autoEscape)); -// } -// -// public void submit(long groupId, JsonArray msg, boolean autoEscape) { -// Const.LOGGER.debug(String.format("转发游戏消息: %s", msg)); -// executor.submit(() -> McBot.bot.sendGroupMsg(groupId, msg, autoEscape)); -// } -// -// public void submit(String guildID, String channelID, String message) { -// Const.LOGGER.debug(String.format("转发游戏消息: %s", message)); -// executor.submit(() -> McBot.bot.sendGuildMsg(guildID, channelID, message)); -// } -// -// public void submit(String guildID, String channelID, JsonArray message) { -// Const.LOGGER.debug(String.format("转发游戏消息: %s", message)); -// executor.submit(() -> McBot.bot.sendGuildMsg(guildID, channelID, message)); -// } -// -// public void stop() { -// executor.shutdown(); -// } -//}