-
Notifications
You must be signed in to change notification settings - Fork 16
Add Folia Support with minimal code changes #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
451ae2c
9489200
d431473
5de108a
15555f8
3b31b2a
8f61acd
f287a53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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) | ||||||||||||||
|
||||||||||||||
| chatfilter.bypass.ip` – Allows the player to bypass all ip 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) |
Copilot
AI
Aug 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing opening backtick and dash formatting before 'chatfilter.bypass.ip' - should be - chatfilter.bypass.ip` for consistency with other permission entries.
| chatfilter.bypass.ip` – Allows the player to bypass all ip filters (chat ,books, commands etc) | |
| - `chatfilter.bypass.ip` – Allows the player to bypass all ip filters (chat ,books, commands etc) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,8 +12,13 @@ | |||||
| 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 com.github.Anon8281.universalScheduler.scheduling.schedulers.TaskScheduler; | ||||||
| import com.github.Anon8281.universalScheduler.UniversalScheduler; | ||||||
|
|
||||||
| import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; | ||||||
|
|
||||||
| import org.bukkit.Bukkit; | ||||||
| import org.bukkit.ChatColor; | ||||||
| import org.bukkit.command.ConsoleCommandSender; | ||||||
| import org.bukkit.configuration.InvalidConfigurationException; | ||||||
| import org.bukkit.configuration.file.FileConfiguration; | ||||||
|
|
@@ -38,8 +43,13 @@ | |||||
| import java.util.concurrent.Callable; | ||||||
| import java.util.regex.Pattern; | ||||||
|
|
||||||
| @SuppressWarnings("deprecation") | ||||||
| public class ChatFilter extends JavaPlugin { | ||||||
|
|
||||||
| private static TaskScheduler scheduler; | ||||||
| private static ChatFilter instance; | ||||||
| private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacyAmpersand(); | ||||||
|
|
||||||
| public ConsoleCommandSender consoleSender = Bukkit.getConsoleSender(); | ||||||
| public ChatFilter chatFilter; | ||||||
| public ChatFilters chatFilters; | ||||||
|
|
@@ -132,6 +142,10 @@ public void onEnable() { | |||||
| } catch (MalformedURLException e) { | ||||||
| e.printStackTrace(); | ||||||
| } | ||||||
|
|
||||||
| scheduler = UniversalScheduler.getScheduler(this); | ||||||
| instance = this; | ||||||
|
|
||||||
| createCustomConfig(); | ||||||
| loadVariables(); | ||||||
| getCommand("chatfilter").setExecutor(new CommandMain(this)); | ||||||
|
|
@@ -236,9 +250,11 @@ public void loadVariables() { | |||||
|
|
||||||
| public String colour(String s) { | ||||||
| if (manager.supported("hex")) { | ||||||
| return manager.colorStringHex(s); | ||||||
| return Manager.colorStringHex(s); | ||||||
|
||||||
| return Manager.colorStringHex(s); | |
| return manager.colorStringHex(s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing opening backtick before 'chatfilter.bypass.swear.' - should be
chatfilter.bypass.swear.<config entry>for consistency with other permission entries.