From 2f96338107b45feb2b75ccd9f343d0fe0d943770 Mon Sep 17 00:00:00 2001 From: liujiahua123123 Date: Tue, 10 Sep 2019 19:52:13 +0800 Subject: [PATCH] thread-pool --- mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java | 4 ++++ .../src/main/java/net/mamoe/mirai/event/MiraiEventHook.java | 5 +++++ mirai-core/src/test/java/ImageOutputTest.java | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java b/mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java index d959f504a..3316f13c9 100644 --- a/mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java +++ b/mirai-core/src/main/java/net/mamoe/mirai/MiraiMain.java @@ -1,6 +1,10 @@ package net.mamoe.mirai; +import net.mamoe.mirai.event.MiraiEventHook; +import net.mamoe.mirai.event.MiraiEventManager; +import net.mamoe.mirai.event.events.qq.FriendMessageEvent; + /** * @author Him188moe */ diff --git a/mirai-core/src/main/java/net/mamoe/mirai/event/MiraiEventHook.java b/mirai-core/src/main/java/net/mamoe/mirai/event/MiraiEventHook.java index d46deb7d8..e1ea7fab6 100644 --- a/mirai-core/src/main/java/net/mamoe/mirai/event/MiraiEventHook.java +++ b/mirai-core/src/main/java/net/mamoe/mirai/event/MiraiEventHook.java @@ -95,6 +95,11 @@ public class MiraiEventHook implements Closeable { MiraiEventManager.getInstance().registerHook(this); } + public void mountAlways(){ + if(this.handler == null)this.handler = a -> {}; + MiraiEventManager.getInstance().hookAlways(this); + } + public void mountOnce(){ if(this.handler == null)this.handler = a -> {}; MiraiEventManager.getInstance().hookOnce(this); diff --git a/mirai-core/src/test/java/ImageOutputTest.java b/mirai-core/src/test/java/ImageOutputTest.java index bebd617cf..988b28841 100644 --- a/mirai-core/src/test/java/ImageOutputTest.java +++ b/mirai-core/src/test/java/ImageOutputTest.java @@ -7,8 +7,8 @@ import java.io.IOException; public class ImageOutputTest { public static void main(String[] args) throws IOException { - BufferedImage image = ImageIO.read(new File((System.getProperty("user.dir") + "/VerificationCode.png").replace("//","/"))); - CharImageConverter charImageConvertor = new CharImageConverter(image,100); + BufferedImage image = ImageIO.read(new File((System.getProperty("user.dir") + "/mirai.png").replace("//","/"))); + CharImageConverter charImageConvertor = new CharImageConverter(image,80); System.out.println(charImageConvertor.call()); } }