Skip to content

Commit

Permalink
fix bug and finish issue#1
Browse files Browse the repository at this point in the history
  • Loading branch information
hank9999 committed May 31, 2020
1 parent eede059 commit 4bfd1d9
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 29 deletions.
47 changes: 31 additions & 16 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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>com.github.hank9999</groupId>
<artifactId>KeywordBlock</artifactId>
<version>1.6.5</version>
<version>1.6.6</version>
<packaging>jar</packaging>

<name>KeywordBlock</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,16 @@ public void onChat(AsyncPlayerChatEvent event) {
new BukkitRunnable() {
@Override
public void run() {
KeywordBlock.plugin.getServer().dispatchCommand(
KeywordBlock.plugin.getServer().getConsoleSender(),
Objects.requireNonNull(
Objects.requireNonNull(
KeywordBlock.plugin.getConfig().getString("mute.command")
).replaceAll("%player%", username)
)
);
for (String command : KeywordBlock.plugin.getConfig().getStringList("mute.command")) {
KeywordBlock.plugin.getServer().dispatchCommand(
KeywordBlock.plugin.getServer().getConsoleSender(),
Objects.requireNonNull(
Objects.requireNonNull(
command
).replaceAll("%player%", username)
)
);
}
}
}.runTask(KeywordBlock.plugin);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ public void onCommands(PlayerCommandPreprocessEvent e) {
String pcommand = e.getMessage();
for (String lcommand : KeywordBlock.plugin.getConfig().getStringList("detect_other.command")) {
if (pcommand.toLowerCase().indexOf(lcommand.toLowerCase()) == 0) {
String m1 = pcommand.replace(lcommand, "");
String pcommand_main = pcommand.split("\\s+")[0];
if (!pcommand_main.equalsIgnoreCase(lcommand)) {
return;
}
String m1 = pcommand.replace(lcommand, "").toLowerCase();
for (Player p : KeywordBlock.plugin.getServer().getOnlinePlayers()) {
m1 = m1.replace(p.getName(), "");
m1 = m1.replace(p.getName().toLowerCase(), "");
}
String text = ChatColor.stripColor(m1.trim());
String text_low_source = text.toLowerCase();
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ message:
mute:
times: 3
keepptime: 3600
command: 'mute %player% 30min Please mind your words'
command:
- 'mute %player% 30min Please mind your words'
message:
- '&2[&dKeywordBlock&2] &cYou were muted. Please mind your words.'

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.6.5
v1.6.6

0 comments on commit 4bfd1d9

Please sign in to comment.