@@ -29,11 +29,18 @@ public void onFriendMessageReceive(PrivateMessage e){
29
29
30
30
QQBot bot = (QQBot ) PlumBot .getBot ();
31
31
32
+ Pattern pattern ;
33
+ Matcher matcher ;
32
34
33
35
if (e .getMessage ().equals (Prefix +"在线人数" )) {
34
36
if (!Config .Online ()){
35
37
return ;
36
38
}
39
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
40
+ matcher = pattern .matcher (e .getMessage ());
41
+ if (matcher .find ()){
42
+ return ;
43
+ }
37
44
bot .sendMsg (false , "当前在线:" + "(" +Bukkit .getServer ().getOnlinePlayers ().size ()+"人)" +ServerManager .listOnlinePlayer (), e .getUserId ());
38
45
return ;
39
46
}
@@ -42,22 +49,28 @@ public void onFriendMessageReceive(PrivateMessage e){
42
49
if (!Config .TPS ()){
43
50
return ;
44
51
}
52
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
53
+ matcher = pattern .matcher (e .getMessage ());
54
+ if (matcher .find ()){
55
+ return ;
56
+ }
45
57
ServerTps st = new ServerTps ();
46
58
bot .sendMsg (false , "当前tps:" + st .getTps () + "\n " + "当前MSPT:" + st .getMSPT (),e .getUserId ());
47
59
return ;
48
60
}
49
61
50
62
if (Config .getAdmins ().contains (e .getUserId ())) {
51
-
52
- Pattern pattern ;
53
- Matcher matcher ;
54
-
55
63
pattern = Pattern .compile (Prefix +"cmd .*" );
56
64
matcher = pattern .matcher (e .getMessage ());
57
65
if (matcher .find ()) {
58
66
if (!Config .CMD ()){
59
67
return ;
60
68
}
69
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
70
+ matcher = pattern .matcher (matcher .group ());
71
+ if (matcher .find ()){
72
+ return ;
73
+ }
61
74
String cmd = matcher .group ().replace (Prefix +"cmd " , "" );
62
75
bot .sendMsg (false , "已发送指令至服务器" ,e .getUserId ());
63
76
PlumBot .getScheduler ().runTaskAsynchronously (()->{
@@ -111,6 +124,11 @@ public void onGroupMessageReceive(GroupMessage e){
111
124
if (!Config .CMD ()){
112
125
return ;
113
126
}
127
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
128
+ matcher = pattern .matcher (msg );
129
+ if (matcher .find ()){
130
+ return ;
131
+ }
114
132
String cmd = matcher .group ().replace (Prefix +"cmd " , "" );
115
133
bot .sendMsg (true , "已发送指令至服务器" ,groupID );
116
134
PlumBot .getScheduler ().runTaskAsynchronously (()->{
@@ -126,6 +144,11 @@ public void onGroupMessageReceive(GroupMessage e){
126
144
if (!Config .WhiteList ()) {
127
145
return ;
128
146
}
147
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
148
+ matcher = pattern .matcher (msg );
149
+ if (matcher .find ()){
150
+ return ;
151
+ }
129
152
String name = matcher .group ().replace (Prefix + "删除白名单 " , "" );
130
153
if (name .isEmpty ()) {
131
154
bot .sendMsg (true , "id不能为空" , groupID );
@@ -149,6 +172,11 @@ public void onGroupMessageReceive(GroupMessage e){
149
172
if (!Config .SDC ()){
150
173
return ;
151
174
}
175
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
176
+ matcher = pattern .matcher (msg );
177
+ if (matcher .find ()){
178
+ return ;
179
+ }
152
180
String scmd = matcher .group ().replace (Prefix +"" , "" );
153
181
String gcmd = Config .getCommandsYaml ().getString ("Admin." +scmd );
154
182
if (gcmd !=null ) {
@@ -188,6 +216,11 @@ public void onGroupMessageReceive(GroupMessage e){
188
216
if (!Config .Online ()){
189
217
return ;
190
218
}
219
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
220
+ matcher = pattern .matcher (msg );
221
+ if (matcher .find ()){
222
+ return ;
223
+ }
191
224
bot .sendMsg (true , "当前在线:" + "(" +Bukkit .getServer ().getOnlinePlayers ().size ()+"人)" +ServerManager .listOnlinePlayer (),groupID );
192
225
return ;
193
226
}
@@ -196,6 +229,11 @@ public void onGroupMessageReceive(GroupMessage e){
196
229
if (!Config .TPS ()){
197
230
return ;
198
231
}
232
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
233
+ matcher = pattern .matcher (msg );
234
+ if (matcher .find ()){
235
+ return ;
236
+ }
199
237
ServerTps st = new ServerTps ();
200
238
bot .sendMsg (true , "当前tps:" + st .getTps () + "\n " + "当前MSPT:" + st .getMSPT (),groupID );
201
239
return ;
@@ -207,6 +245,11 @@ public void onGroupMessageReceive(GroupMessage e){
207
245
if (!Config .WhiteList ()) {
208
246
return ;
209
247
}
248
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
249
+ matcher = pattern .matcher (msg );
250
+ if (matcher .find ()){
251
+ return ;
252
+ }
210
253
String PlayerName = matcher .group ().replace (Prefix + "申请白名单 " , "" );
211
254
if (PlayerName .isEmpty ()) {
212
255
bot .sendMsg (true , "id不能为空" , groupID );
@@ -229,6 +272,11 @@ public void onGroupMessageReceive(GroupMessage e){
229
272
if (!Config .WhiteList ()) {
230
273
return ;
231
274
}
275
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
276
+ matcher = pattern .matcher (msg );
277
+ if (matcher .find ()){
278
+ return ;
279
+ }
232
280
String name = matcher .group ().replace (Prefix + "删除白名单 " , "" );
233
281
PlumBot .getScheduler ().runTaskAsynchronously (() -> {
234
282
String idForName = DatabaseManager .getBind (String .valueOf (senderID ), DataBase .type ().toLowerCase (), PlumBot .getDatabase ());
@@ -257,6 +305,11 @@ public void onGroupMessageReceive(GroupMessage e){
257
305
if (!Config .SDC ()){
258
306
return ;
259
307
}
308
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
309
+ matcher = pattern .matcher (msg );
310
+ if (matcher .find ()){
311
+ return ;
312
+ }
260
313
String scmd = matcher .group ().replace (Prefix +"" , "" );
261
314
String gcmd = Config .getCommandsYaml ().getString ("User." +scmd );
262
315
if (gcmd !=null ) {
@@ -271,6 +324,11 @@ public void onGroupMessageReceive(GroupMessage e){
271
324
if (Config .SDR ()){
272
325
String back = Config .getReturnsYaml ().getString (msg );
273
326
if (back !=null ){
327
+ pattern = Pattern .compile ("\\ [CQ:.*].*" );
328
+ matcher = pattern .matcher (msg );
329
+ if (matcher .find ()){
330
+ return ;
331
+ }
274
332
bot .sendMsg (true , back ,groupID );
275
333
return ;
276
334
}
0 commit comments