Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorOSS committed Feb 23, 2024
1 parent cf2861d commit 4856462
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 25 deletions.
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.meteor</groupId>
<artifactId>wechat-bc</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
<build>
<plugins>
<plugin>
Expand Down
1 change: 1 addition & 0 deletions draw.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 15 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.meteor</groupId>
<artifactId>wechat-bc</artifactId>
<version>1.0.9-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>

<distributionManagement>
<repository>
Expand Down Expand Up @@ -105,6 +105,14 @@
<version>2.2</version>
</dependency>

<dependency>
<groupId>com.test</groupId>
<artifactId>draw</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/plugins/WeChatSetu-1.0-SNAPSHOT.jar</systemPath>
</dependency>

<dependency>
<groupId>com.github.SNWCreations</groupId>
<artifactId>TerminalConsoleAppender</artifactId>
Expand All @@ -129,6 +137,12 @@
<version>3.0.0</version>
</dependency>

<dependency>
<groupId>dev.ai4j</groupId>
<artifactId>openai4j</artifactId>
<version>0.13.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions release_info.info
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v1.0.9
DESCRIPTION=feat: 更新检测
feat: Scheduler模块
VERSION=v1.1.0
DESCRIPTION=fix: 载入插件时未判断是否为jar文件,导致plugins内有插件生成的配置文件时将报错
fix: 子ConfigurationSection读取不工作

1 change: 1 addition & 0 deletions src/main/java/com/meteor/wechatbc/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ public int start(){
return 0;
}


}
20 changes: 14 additions & 6 deletions src/main/java/com/meteor/wechatbc/config/FileConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ public void set(String path, Object value) {

@Override
public ConfigurationSection getConfigurationSection(String path) {
Object value = data.get(path);
if (value instanceof Map) {
SimpleConfigurationSection section = new SimpleConfigurationSection();
section.data = (Map<String, Object>) value;
return section;
String[] keys = path.split("\\.");
Map<String, Object> current = data;

for (String key : keys) {
Object value = current.get(key);
if (value instanceof Map) {
current = (Map<String, Object>) value;
} else {
return null;
}
}
return null;

SimpleConfigurationSection section = new SimpleConfigurationSection();
section.data = current;
return section;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ public void set(String path, Object value) {

@Override
public ConfigurationSection getConfigurationSection(String path) {
Object val = data.get(path);
if (val instanceof Map) {
SimpleConfigurationSection section = new SimpleConfigurationSection();
section.data = (Map<String, Object>) val;
return section;
String[] keys = path.split("\\.");
Map<String, Object> current = data;

for (String key : keys) {
Object value = current.get(key);
if (value instanceof Map) {
current = (Map<String, Object>) value;
} else {
return null;
}
}
return null;

SimpleConfigurationSection section = new SimpleConfigurationSection();
section.data = current;
return section;
}

@Override
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/com/meteor/wechatbc/config/YamlConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@ public void save(File file) throws IOException {

@Override
public ConfigurationSection getConfigurationSection(String path) {
Object value = data.get(path);
if (value instanceof Map) {
YamlConfiguration section = new YamlConfiguration();
section.data = (Map<String, Object>) value;
return section;
String[] keys = path.split("\\.");
Map<String, Object> current = data;

for (String key : keys) {
Object value = current.get(key);
if (value instanceof Map) {
current = (Map<String, Object>) value;
} else {
return null; // 如果路径中的任何部分不是 Map,则返回 null
}
}
return null;

SimpleConfigurationSection section = new SimpleConfigurationSection();
section.data = current;
return section;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String[] formatArgs(){
}

public String getMainCommand(){
System.out.println(command);
if(!command.contains(" ")) return command;
return command.substring(0,command.indexOf(" "));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public PluginManager(WeChatClient weChatClient){
pluginsFolder.mkdirs();
}
for (File pluginFile : pluginsFolder.listFiles()) {
this.loadPlugin(pluginFile);
if(pluginFile.isFile()){
this.loadPlugin(pluginFile);
}
}
PluginLoader.logger.info("载入了 {} 个插件",pluginMap.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ private void handlerMessage(){
private void callMessageEvent(MessageEvent messageEvent){
Message message = messageEvent.getMessage();
EventManager eventManager = weChatClient.getEventManager();

eventManager.callEvent(messageEvent);

Session session = weChatClient.getWeChatCore().getSession();
Expand Down

0 comments on commit 4856462

Please sign in to comment.