diff --git a/pom.xml b/pom.xml
index 553f3f2..8ef13dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- org.example
+ com.meteor
WeChatBc
- 1.0.4-SNAPSHOT
+ 1.0.5-SNAPSHOT
8
@@ -34,7 +34,7 @@
org.apache.maven.plugins
maven-shade-plugin
- 3.2.4
+ 3.2.4
package
@@ -125,11 +125,13 @@
4.13.1
test
+
com.squareup.okhttp3
okhttp
3.14.9
+
org.jetbrains
annotations
diff --git a/release_info.info b/release_info.info
index 1e11d90..caaff89 100644
--- a/release_info.info
+++ b/release_info.info
@@ -1,5 +1,5 @@
-VERSION=v1.0.4
-DESCRIPTION=如下:
-https://github.com/meteorOSS/WeChatBc
-fix: 视频文件上传时无法获取mime类型
-feath: 视频消息,发送接口
+VERSION=v1.0.5
+DESCRIPTION=feath: 插件在加载后将生成一个以插件名命名的目录,可通过BasePlugin.getDataFolder获取
+feath: BasePlugin移除暂时无用的hook
+feath: BasePlugin新增getResource(String file)函数用于获取jar内的文件
+fix: 删除一些调试用的日志打印
\ No newline at end of file
diff --git a/src/main/java/com/meteor/wechatbc/impl/cookie/WeChatCookie.java b/src/main/java/com/meteor/wechatbc/impl/cookie/WeChatCookie.java
index 1a41a36..493de1e 100644
--- a/src/main/java/com/meteor/wechatbc/impl/cookie/WeChatCookie.java
+++ b/src/main/java/com/meteor/wechatbc/impl/cookie/WeChatCookie.java
@@ -14,7 +14,6 @@ public class WeChatCookie implements CookieJar {
private List initCookie;
private Map> cookieListMap;
-
public WeChatCookie(List initCookie){
this.initCookie = initCookie;
this.cookieListMap = new HashMap<>();
diff --git a/src/main/java/com/meteor/wechatbc/impl/model/message/ImageMessage.java b/src/main/java/com/meteor/wechatbc/impl/model/message/ImageMessage.java
index dd0cf52..93774c0 100644
--- a/src/main/java/com/meteor/wechatbc/impl/model/message/ImageMessage.java
+++ b/src/main/java/com/meteor/wechatbc/impl/model/message/ImageMessage.java
@@ -36,9 +36,9 @@ public BufferedImage convertHexToBufferedImage() {
* 将图片保存至磁盘
* @param file
*/
- public void saveImage(File file) {
+ public void saveImage(File file,String type) {
try {
- ImageIO.write(convertHexToBufferedImage(), "PNG", file);
+ ImageIO.write(convertHexToBufferedImage(), type, file);
} catch (IOException e) {
e.printStackTrace();
}
diff --git a/src/main/java/com/meteor/wechatbc/plugin/BasePlugin.java b/src/main/java/com/meteor/wechatbc/impl/plugin/BasePlugin.java
similarity index 89%
rename from src/main/java/com/meteor/wechatbc/plugin/BasePlugin.java
rename to src/main/java/com/meteor/wechatbc/impl/plugin/BasePlugin.java
index 15f349c..f38ad29 100644
--- a/src/main/java/com/meteor/wechatbc/plugin/BasePlugin.java
+++ b/src/main/java/com/meteor/wechatbc/impl/plugin/BasePlugin.java
@@ -1,7 +1,9 @@
-package com.meteor.wechatbc.plugin;
+package com.meteor.wechatbc.impl.plugin;
import com.meteor.wechatbc.impl.WeChatClient;
+import com.meteor.wechatbc.plugin.Plugin;
+import com.meteor.wechatbc.plugin.PluginDescription;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -32,7 +34,10 @@ public void init(
}
public BasePlugin(){
+ }
+ @Override
+ public void onDisable() {
}
@Override
diff --git a/src/main/java/com/meteor/wechatbc/impl/plugin/PluginManager.java b/src/main/java/com/meteor/wechatbc/impl/plugin/PluginManager.java
index 665ad6a..5c52c4e 100644
--- a/src/main/java/com/meteor/wechatbc/impl/plugin/PluginManager.java
+++ b/src/main/java/com/meteor/wechatbc/impl/plugin/PluginManager.java
@@ -2,10 +2,7 @@
import com.meteor.wechatbc.Main;
import com.meteor.wechatbc.impl.WeChatClient;
-import com.meteor.wechatbc.plugin.BasePlugin;
-import com.meteor.wechatbc.plugin.PluginClassLoader;
-import com.meteor.wechatbc.plugin.PluginDescription;
-import com.meteor.wechatbc.plugin.PluginLoader;
+import com.meteor.wechatbc.plugin.*;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
@@ -21,6 +18,7 @@ public class PluginManager {
private Map pluginMap = new ConcurrentHashMap<>();
+
private WeChatClient weChatClient;
public PluginManager(WeChatClient weChatClient){
@@ -34,7 +32,16 @@ public PluginManager(WeChatClient weChatClient){
this.loadPlugin(pluginFile);
}
PluginLoader.logger.info("载入了 {} 个插件",pluginMap.size());
+ }
+ /**
+ * 卸载插件
+ */
+ public void unload(BasePlugin plugin){
+ String pluginName = plugin.getPluginDescription().getName();
+ weChatClient.getEventManager().unRegisterPluginListener(plugin);
+ pluginMap.remove(plugin,pluginName);
+ PluginLoader.logger.info("已卸载 {}",pluginName);
}
/**