Skip to content

Commit

Permalink
[Fix] detection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hank9999 committed May 4, 2020
1 parent 3a83058 commit a1c867b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void onChat(AsyncPlayerChatEvent event) {
+ key_text_replaceall_no.replaceAll("[^a-zA-Z]", "") + " "
+ key_text_replaceall_no.replaceAll("[^a-zA-Z0-9]", "") + " "
+ key_text_replaceall_no.replaceAll("[^\\u4E00-\\u9FA5]", "") + " "
+ key_text_c.replaceAll("[\\p{P}+~$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "") + " "
+ key_text_c_no.replaceAll("[\\p{P}+~$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "");
+ key_text_c.replaceAll("[\\p{P}+~$`^:=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "") + " "
+ key_text_c_no.replaceAll("[\\p{P}+:~$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "");

for (String keyword1 : KeywordBlock.plugin.getConfig().getStringList("words")) {
String keyword2 = keyword1.toLowerCase();
Expand All @@ -62,7 +62,7 @@ public void onChat(AsyncPlayerChatEvent event) {
Matcher m1 = p1.matcher(all);
Pattern p2 = Pattern.compile(keyword2);
Matcher m2 = p2.matcher(all);
if (m1.lookingAt() || m2.lookingAt()) {
if (m1.lookingAt() || m2.lookingAt() || all.contains(keyword2)) {
event.setCancelled(true);
for (String warn_message : KeywordBlock.plugin.getConfig().getStringList("message.warn.player")) {
player.sendMessage(Lib.color_translate(warn_message.replaceAll("%player_name%", username).replaceAll("%player_message%", text)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void onCommands(PlayerCommandPreprocessEvent e) {
+ key_text_replaceall_no.replaceAll("[^a-zA-Z]", "") + " "
+ key_text_replaceall_no.replaceAll("[^a-zA-Z0-9]", "") + " "
+ key_text_replaceall_no.replaceAll("[^\\u4E00-\\u9FA5]", "") + " "
+ key_text_c.replaceAll("[\\p{P}+~$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "") + " "
+ key_text_c_no.replaceAll("[\\p{P}+~$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "");
+ key_text_c.replaceAll("[\\p{P}+~:$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "") + " "
+ key_text_c_no.replaceAll("[\\p{P}+~:$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!…*丶—【】,;‘:”“’]", "");

for (String keyword1 : KeywordBlock.plugin.getConfig().getStringList("words")) {
String keyword2 = keyword1.toLowerCase();
Expand All @@ -69,7 +69,7 @@ public void onCommands(PlayerCommandPreprocessEvent e) {
Matcher m01 = p01.matcher(all);
Pattern p02 = Pattern.compile(keyword2);
Matcher m02 = p02.matcher(all);
if (m01.lookingAt() || m02.lookingAt()) {
if (m01.lookingAt() || m02.lookingAt() || all.contains(keyword2)) {
e.setCancelled(true);
for (String warn_message : KeywordBlock.plugin.getConfig().getStringList("message.warn.player")) {
player.sendMessage(Lib.color_translate(warn_message.replaceAll("%player_name%", username).replaceAll("%player_message%", text)));
Expand Down

0 comments on commit a1c867b

Please sign in to comment.