Skip to content

Commit

Permalink
fix: on ListenerHost change load
Browse files Browse the repository at this point in the history
  • Loading branch information
Kloping committed Dec 1, 2023
1 parent bd562fd commit 516b214
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.kloping</groupId>
<artifactId>bot-qqpd-java</artifactId>
<version>1.5.0-Beta5</version>
<version>1.5.0-Alpha6</version>

<packaging>jar</packaging>
<name>bot-qqpd-java</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public String getClassName() {

@Override
public String toString() {
return String.format("Bot(%s) Connected! By author kloping of bot-qqpd-java for version 1.5.0-Beta5", bot.getConfig().getAppid());
return String.format("Bot(%s) Connected! By author kloping of bot-qqpd-java for version 1.5.0-Alpha6", bot.getConfig().getAppid());
}
}
5 changes: 4 additions & 1 deletion src/main/java/io/github/kloping/qqbot/network/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,17 @@ private void onEvent(String t, JSONObject obj) throws Exception {
}

private final Map<Method, ListenerHost> m2l = new HashMap<>();
private int cap = 0;

private Map<Method, ListenerHost> getM2L() {
if (m2l.isEmpty()) {
if (m2l.isEmpty() || cap != config.getListenerHosts().size()) {
synchronized (m2l) {
cap = 0;
for (ListenerHost listenerHost : config.getListenerHosts()) {
for (Method method : InvokeUtils.getAllMethod(listenerHost)) {
m2l.put(method, listenerHost);
}
cap++;
}
}
}
Expand Down

0 comments on commit 516b214

Please sign in to comment.