From c46974e74c11b0497b2ebc2080f7ad1bdd72d5a4 Mon Sep 17 00:00:00 2001
From: TheJoeCoder <joe@radialbog9.uk>
Date: Tue, 25 Jul 2023 19:52:27 +0100
Subject: [PATCH] Add README and fix bug

Signed-off-by: TheJoeCoder <joe@radialbog9.uk>
---
 README.md                                     | 33 +++++++++++++++++++
 .../simplechatfilter/SimpleChatFilter.java    |  2 +-
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 README.md

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..629309f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,33 @@
+# SimpleChatFilter
+A simple chat filter for Bungeecord servers.
+
+## Permissions
+* `simplechatfilter.bypass.<category>` - Bypass the chat filter for the category.
+* `simplechatfilter.bypass.*` - Bypass the chat filter entirely.
+* `simplechatfilter.staff` - See staff message when a player breaches the chat filter.
+
+## Configuration
+```yaml
+# The list of categories to be filtered.
+# Place the categories in order of severity, highest first.
+# Only the most severe category will be applied to a message.
+categories:
+  # A category name
+  # Can be anything you want
+  advertising-pfcloud:
+    # Blocked phrases
+    # These are case-insensitive.
+    # If the message contains any of these, it will be blocked.
+    blocked:
+      - a friendly bot designed to join servers
+      - If you are searching for a good server hosting provider
+      - https://shop.pfcloud.io
+    # The commands to run when a message is blocked. Use {username} for the offending player's username.
+    commands:
+      - ipban {username} Bot/Advertising -s
+    # A message to send to the player when their message is blocked.
+    message: '&cPlease do not advertise!'
+
+# The message to send to staff when a player breaches the chat filter.
+staff-message: '&a[ChatFilter] &c{username} &7 broke rule &c{category} &7on server &c{server}&7.'
+```
\ No newline at end of file
diff --git a/src/main/java/net/dappergoose/simplechatfilter/SimpleChatFilter.java b/src/main/java/net/dappergoose/simplechatfilter/SimpleChatFilter.java
index a443317..f2ce6a9 100644
--- a/src/main/java/net/dappergoose/simplechatfilter/SimpleChatFilter.java
+++ b/src/main/java/net/dappergoose/simplechatfilter/SimpleChatFilter.java
@@ -95,7 +95,7 @@ public final class SimpleChatFilter extends Plugin implements Listener {
                     )
             ));
             for(String command : pluginConfig.getStringList("categories." + matchedCategory + ".commands")) {
-                getProxy().getPluginManager().dispatchCommand(getProxy().getConsole(), command.replace("{player}", p.getName()));
+                getProxy().getPluginManager().dispatchCommand(getProxy().getConsole(), command.replace("{username}", p.getName()));
             }
         }
     }
-- 
GitLab