Skip to content

Commit

Permalink
v1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorOSS committed Feb 17, 2024
1 parent af2eb79 commit 6475f25
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 16 deletions.
8 changes: 5 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<groupId>com.meteor</groupId>
<artifactId>WeChatBc</artifactId>
<version>1.0.4-SNAPSHOT</version>
<version>1.0.5-SNAPSHOT</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down Expand Up @@ -34,7 +34,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version> <!-- 使用最新版本 -->
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -125,11 +125,13 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.9</version>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
Expand Down
10 changes: 5 additions & 5 deletions release_info.info
Original file line number Diff line number Diff line change
@@ -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: 删除一些调试用的日志打印
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class WeChatCookie implements CookieJar {
private List<Cookie> initCookie;
private Map<HttpUrl,List<Cookie>> cookieListMap;


public WeChatCookie(List<Cookie> initCookie){
this.initCookie = initCookie;
this.cookieListMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -32,7 +34,10 @@ public void init(
}

public BasePlugin(){
}

@Override
public void onDisable() {
}

@Override
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/com/meteor/wechatbc/impl/plugin/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,6 +18,7 @@ public class PluginManager {

private Map<String,BasePlugin> pluginMap = new ConcurrentHashMap<>();


private WeChatClient weChatClient;

public PluginManager(WeChatClient weChatClient){
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 6475f25

Please sign in to comment.