Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# ChatFilter
Chat Filter is a chat management plugin for reducing spam, swearing, advertisement of IPs and URLs. Stop repetition in chat and add as many swear words, IPs and URLs as you want to make sure your server chat is controlled! This plugin also filters books, signs, commands and anvils.
Chat Filter is a chat management plugin for reducing spam, swearing, advertisement of IPs and URLs. Stop repetition in chat and add as many swear words, IPs and URLs as you want to make sure your server chat is controlled! This plugin also filters books, signs, commands and anvils. More details below!

## Features
- **Regex filtering:** Utilizes the use of regex to prevent bypassing of the filter.
- **Multiple Filters:** Filter words, IPs and URLs covering chat, anvils, signs, commands and books.
- **Unicode support:** Prevents the use of certain Unicode common with hacked clients. (hacker font)
- **Anti Spam:** Stop repetitive or similar messages aswell as excessive CAPS and character spam. (Player names exempt)
- **Punishments:** Execute commands when a player is caught by the filter.
- **Commands:** In-game regex generator for words, whitelisting of words, pause and clear chat.
- **Notify staff:** Alerts and highlights swearing and advertising to players with the correct permission.
- **Customizability:** All messages are fully modifiable - Hex compatible.
- **Preset words:** Over 55+ preset English words.
- **No bloat features:** ChatFilter has been made to stay simple and basic.
- **Languages files:** ChatFilter currently supports English, Danish, Chinese (Thanks to Zhaomengran) and Spanish.

## Commands
- `/clearchat (/cf clear)` – Clears the chat.
- `/cf help` – Displays a list of the plugin’s commands.
- `/cf reload` – Reloads the plugin config.
- `/cf blacklist (ip/word) list/add/remove <args/word/IP>` – Blacklists a chosen word or IP. (Will not allow this word/IP to go throught the filter)
- `/cf whitelist (ip/word) list/add/remove <args/word/IP>` – Whitelists a chosen word or IP. (Will allow a string of characters/a word or IP to go through the filter)
- `/cf import` - Import plain text words
- `/cf pause` – Pause chat for players that do not have the bypass perm.

## Permissions
- `chatfilter.reload` – Allows players to use /cf reload
- `chatfilter.blacklist` – Allows players to use /cf blacklist
- `chatfilter.whitelist` – Allows players to use /cf whitelist
- `chatfilter.blacklist.remove` – Allows players to use /cf whitelist remove
- `chatfilter.whitelist.remove` – Allows players to use /cf whitelist remove
- `chatfilter.view` – Allows players to to view what gets caught in the filter
- `chatfilter.pause` – Allows players to pause the chat
- `chatfilter.bypass` – Allows the player to bypass all filters(Chat, Signs, Books, Anvils, Decaps, pause chat and repeat messages)
- `chatfilter.bypass.chat` – Allows the player to bypass in chat
- `chatfilter.bypass.sign` – Allows the player to bypass on a sign
- `chatfilter.bypass.anvil` – Allows the player to bypass in a anvil
- `chatfilter.bypass.book` – Allows the player to bypass in books
- `chatfilter.bypass.command` – Allows the player to bypass in commands
- `chatfilter.bypass.repeat` – Allows the player to bypass repeat messages
- `chatfilter.bypass.caps` –Allows the player to bypass chat decapping
- `chatfilter.bypass.pause` – Allows the player to bypass paused chat
- `chatfilter.bypass.swear` – Allows the player to bypass all swear filters (chat ,books, commands etc)
- chatfilter.bypass.swear.<config entry>` – Allows the player to bypass set config entries (chat ,books, commands etc)
- chatfilter.bypass.ip.<config entry>` – Allows the player to bypass set config entries (chat ,books, commands etc)
chatfilter.bypass.ip` – Allows the player to bypass all ip filters (chat ,books, commands etc)

# DISCLAIMER
This is a fork of an older plugin by the same name. This fork implements Folia.
24 changes: 22 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>a4.papers.chatfilter</groupId>
<artifactId>chatFilter</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
<packaging>jar</packaging>

<name>ChatFilter</name>
Expand Down Expand Up @@ -39,7 +39,17 @@
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>C:\Users\A4pap\Desktop\Output\ChatFilter.jar</outputFile>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>a4.papers.chatfilter.chatfilter.metrics</shadedPattern>
</relocation>
<relocation>
<pattern>me.hsgamer.hscore</pattern>
<shadedPattern>a4.papers.chatfilter.chatfilter.hscore</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -71,5 +81,15 @@
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>me.hsgamer</groupId>
<artifactId>hscore-bukkit-scheduler</artifactId>
<version>4.3.4</version>
</dependency>
</dependencies>
</project>
20 changes: 7 additions & 13 deletions src/main/java/a4/papers/chatfilter/chatfilter/ChatFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import a4.papers.chatfilter.chatfilter.shared.lang.LangManager;
import a4.papers.chatfilter.chatfilter.shared.regexHandler.LoadFilters;
import a4.papers.chatfilter.chatfilter.shared.regexHandler.RegexpGenerator;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bstats.charts.SingleLineChart;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
Expand Down Expand Up @@ -167,18 +170,9 @@ public void onEnable() {
logMsg("[ChatFilter] " + (byPassWords.size() + byPassWords.size()) + " whitelisted items.");
int pluginId = 13946;
Metrics metrics = new Metrics(this, pluginId);
metrics.addCustomChart(new Metrics.SimplePie("used_language", () -> {
return getLang().locale.toString();
}));
metrics.addCustomChart(new Metrics.SimplePie("total_filters", () -> {
return String.valueOf(regexWords.size() + regexAdvert.size());
}));
metrics.addCustomChart(new Metrics.SingleLineChart("block", new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return blockedInt;
}
}));
metrics.addCustomChart(new SimplePie("used_language", () -> getLang().locale.toString()));
metrics.addCustomChart(new SimplePie("total_filters", () -> String.valueOf(regexWords.size() + regexAdvert.size())));
metrics.addCustomChart(new SingleLineChart("block", () -> blockedInt));
}

@Override
Expand Down Expand Up @@ -288,7 +282,7 @@ public void sendStaffMessage(String str) {

public void sendConsole(Types type, String msg, Player p, String regexUsed, String pl) {
if (!type.equals(Types.NOTYPE)) {
blockedInt = new Integer(blockedInt.intValue() + 1);
blockedInt = blockedInt + 1;
consoleSender.sendMessage("------- Match Type: " + type.id + " ~ " + pl.toUpperCase());
consoleSender.sendMessage("Match: " + regexUsed);
consoleSender.sendMessage("Catch > " + p.getName() + ": " + msg);
Expand Down
Loading