File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
package top .focess .qq .api .command ;
2
2
3
+ import com .google .common .collect .Lists ;
3
4
import com .google .common .collect .Maps ;
4
5
import org .checkerframework .checker .nullness .qual .EnsuresNonNullIf ;
5
6
import org .checkerframework .checker .nullness .qual .NonNull ;
9
10
import top .focess .qq .api .bot .Friend ;
10
11
import top .focess .qq .api .bot .Member ;
11
12
import top .focess .qq .api .bot .Stranger ;
13
+ import top .focess .qq .api .plugin .Plugin ;
12
14
import top .focess .qq .api .util .IOHandler ;
13
15
import top .focess .qq .api .util .session .Session ;
14
16
import top .focess .qq .core .listeners .ChatListener ;
15
17
18
+ import java .util .List ;
16
19
import java .util .Map ;
17
20
import java .util .Objects ;
18
21
@@ -278,4 +281,15 @@ public Bot getBot() {
278
281
public boolean isStranger () {
279
282
return isStranger ;
280
283
}
284
+
285
+ public static void clear (Plugin plugin ) {
286
+ SESSIONS .values ().stream ().map (Session ::getValues ).forEach (map ->{
287
+ List <String > keys = Lists .newArrayList ();
288
+ map .forEach ((key ,value ) -> {
289
+ if (key .startsWith (plugin .getName () + ":" ))
290
+ keys .add (key );
291
+ });
292
+ keys .forEach (map ::remove );
293
+ });
294
+ }
281
295
}
Original file line number Diff line number Diff line change @@ -310,6 +310,8 @@ public static File disablePlugin0(Plugin plugin) {
310
310
if (FocessQQ .getUdpSocket () != null )
311
311
FocessQQ .getUdpSocket ().unregister (plugin );
312
312
}
313
+ CommandSender .clear (plugin );
314
+ FocessQQ .getLogger ().debugLang ("clear-command-sender-session" ,plugin .getName ());
313
315
CLASS_PLUGIN_MAP .remove (plugin .getClass ());
314
316
NAME_PLUGIN_MAP .remove (plugin .getName ());
315
317
File ret = null ;
Original file line number Diff line number Diff line change @@ -188,4 +188,5 @@ register-default-special-argument-handlers: Register default special argument ha
188
188
exec-command-empty-command : The command is empty
189
189
exec-command-error-command : Exec cannot execute command named itself
190
190
section-exception : Section %s exception, %s
191
+ clear-command-sender-session : Clear command sender session with plugin %s
191
192
You can’t perform that action at this time.
0 commit comments