Skip to content

Commit

Permalink
v1.2 Optimize again
Browse files Browse the repository at this point in the history
  • Loading branch information
hank9999 committed Apr 25, 2020
1 parent 6aba4f5 commit 0ff53fa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: KeywordBlock
main: com.github.hank9999.KeywordBlock.KeywordBlock
version: 1.1
version: 1.2
author: hank9999

permissions:
Expand Down
3 changes: 2 additions & 1 deletion src/com/github/hank9999/KeywordBlock/ChatListen.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ public void onChat(AsyncPlayerChatEvent event) {
String key_text = text.replaceAll("&[0-9]|&[a-f]|&[k-o]|&r","");
key_text = key_text.replaceAll( "[\\p{P}+~$`^=./|<>?~`$^+。、?·|()()<>¥×{}&#%@!!……*]" , "");
key_text = key_text.replace(" ","");
String key_text2 = text.replaceAll("&[0-9]|&[a-f]|&[k-o]|&r","").replace(" ","");
for (String keyword : KeywordBlock.plugin.getConfig().getStringList("words")) {
if (keyword.equalsIgnoreCase("")) {
continue;
}
if (key_text.contains(keyword)) {
if (key_text.contains(keyword) || key_text2.contains(keyword)) {
event.setCancelled(true);
for (String warn_message : KeywordBlock.plugin.getConfig().getStringList("message.warn.player")) {
player.sendMessage(Lib.color_translate(warn_message.replace("%player_name%", username).replace("%player_message%", text)));
Expand Down
2 changes: 1 addition & 1 deletion src/com/github/hank9999/KeywordBlock/KeywordBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void onEnable() {
saveDefaultConfig();
reloadConfig();
getLogger().info(ChatColor.BLUE + "关键词屏蔽插件已启用");
getLogger().info(ChatColor.GOLD + "版本v1.1");
getLogger().info(ChatColor.GOLD + "版本v1.2");

if (getConfig().getBoolean("function.detect")) {
getServer().getPluginManager().registerEvents(new ChatListen(), this);
Expand Down

0 comments on commit 0ff53fa

Please sign in to comment.