🚀 UltraServers Relaunch We're thrilled to announce the relaunch of our service with a brand-new, streamlined panel designed to enhance your gaming experience. Join our Discord for more information, lifetime discounts and to take part in our $175 raffle to win Steam gift cards.
Implement Chat Moderation with Regex
In this guide, we will be showing how to implement chat moderation step-by-step and explain how to make use of regex.
Connect to your server
- See our login instructions guide over here!
- Go to your Inventory.
- Once in your inventory, you will see your list of servers.
- Click the Manage button of your Minecraft server that you wish to use for your custom IP.
Installing a chat control plugin (optional step)
- If you already have a chat moderation plugin installed, you can skip this step.
- “ChatControl™ - The Ultimate Chat Plugin” is our recommended plugin due to the advanced features it has and how it can cover a range of areas such as command moderation.
- Make sure to restart your server, so the plugin has been loaded!
Locate your plugin configuration
- Select the File Manager tab from the menu bar to load the File Manager.
- Open the
plugin
folder, locate the folder with the name of your plugin and open it. - If you are using chat control, it’d be ChatControl.
- You will see many options. For now, what we want to do is implement chat moderation, but you are welcome to come back and configure the rest to your preference.
- Open the
rules
folder and open thechat.txt
File, which contains every rule that affects the chat.
Configure the plugin
- Regex is short for Regular expression and its main usage is to detect patterns you tell want it to, regexes can range from a simple
^dog
which would look for anything that start with dog to^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$
which you’d use to find In addresses. - Chat Control contains a few examples to show you how you can configure the moderation rules, of the plugin. Let’s add some of our own.
- Make some space somewhere in the document by adding new lines (enter), write the following piece of text into the file editor.
- In the above example,
badword1
andbadword2
are just placeholders and should be replaced with real words that you want to moderate. - Congrats, you just blocked those words from being said in your server. You may be wondering why bother using regex, like I could just block a ton of words without this fancy random gibberish. Using the regex for
badword1
you just blocked numerous variations or bypasses for this word, whereas you might have had to write out all of those variations. Make sure to save the file (Ctrl+S works).
# ----- i want to prevent people from saying badword1 and its variationmatch b[@b]*a[@a]*d[@d]*w[@w]*o[@o]*r[@r]*d[@d]*1then warn &cPlease do not use cursewords.
then deny
# ---- I want to prevent people from saying badword2.match badword2
then warn &cDont be like that!then deny
Test the filter
- Once you have saved the changes made to chat.txt, head to the Console tab or your in-game console and run
chc reload
. This command will reload the Chat Control plugin and apply the changes you have made. You could also restart your server to apply the changes. - Feel free to try saying words like
badword1
,badworddd1
andbadword2
, you will notice these words are now fully censored.
If you require further assistance, you can open a support ticket here.
Feedback and suggestions can be submitted here, or further discussed on our Discord server.