PwnFilter Port (Chat filtering) [SpongeForge 1000]

I liked this plugin from when i used to run servers, so i decided to port it :wink:

About PwnFilter
PwnFilter is way more than just your average word-blocking plugin, PwnFilter uses the power of Regular-Expressions (“RegEx”)
to give you a highly effective and highly configurable plugin to filter
anything you want from chat! Matching words can be rewritten, logged,
blocked, and managed, depending on the rules you define.
Use PwnFilter for:

  • Extremely effective chat/command filtering: Filter anything you want with RegEx!
  • Extremely effective curse/swear word filtering, warn users who use bad language, turn their profanities into harmless language, or just deny their message entirely!
  • Assign appropriate punishment levels based on severity.
  • Anti-Advertisement: IP/URL filtering
  • Make fun chat replacements for your server’s inside-jokes.
  • Single line spam filtering: Remove repetitive characters like hiiiiiiiiiiiii to hi.
  • CAPS Blocking capability
  • Typo correction: Replace common and annoying typos like “teh” to “the” or “u” or “you”
  • Customizable warning messages
  • Command aliases: Automatically recognize a !command and change to /longer command, Stop yourself from accidentally sending those embarrassing .commands to chat for everyone to see.
  • A few built-in punishments like burn, kill, fine (charge money!), warn, kick, and ban. Or simply utilize the “then console” action
  • o make your server console execute almost any command from any other
  • plugin as if you typed it yourself in the console window, especially if
  • you use a plugin that adds a plethora of punishments, like PunishMental, or use it to make PwnFilter send the appropriate commands to your favorite ban-management system to let it handle what to do!


  • Filter Chat! (of course)
  • Filter Signs!
  • Filter Commands!
  • Filter Console!
  • Built-in anti-spam feature can be enabled in config.
  • Commands by permission node.
  • Supports color message replacement.
  • Globally clear all player’s chat windows with “/pfcls”.
  • Global mute with “/pfmute” - stops all server chat and commands for making admin announcements.
  • Command typos beginning with certain characters can be stopped (like . and 7, accidentally instead of / and &).
  • Optionally recover those typos and execute the command as intended.
  • Define your own macros or command aliases.
  • Simple but powerful configuration with built-in debugging.
  • Each regular expression is compiled only once => very fast.
  • Able to reload all your PwnFilter rules & config files without needing to restart the server with “/pfreload”.
  • Optionally kick or warn players on rule matches AND/OR:
  • Execute commands from console or other plugins.
  • Use randrep action to replace swears with a random multiple option.
  • Use lower action to replace text to all lowercase (great for those CAPS chatters).
  • True command aliases, link faux commands like /wave to /me waves at you.
  • Customizable ‘permission denied’ messages


Filter Nodes

  • pwnfilter.bypass.commands
  • pwnfilter.bypass.mute
  • pwnfilter.bypass.spam
  • pwnfilter.bypass.signs
  • pwnfilter.color

Command Nodes

  • pwnfilter.reload
  • pwnfilter.mute
  • pwnfilter.cls


  • /pfreload - reload the config files + rules
  • /pfmute - toggle global mute
  • /pfcls - clear everyones chat window

Support Me

If you’d like to support me, you can do so here
If you’d like to support the original author, you can do so here


You can head over to the GitHub page to grab the latest build of PwnFilter for Sponge here

GitHub Repository

If you’d like to check out the code, you can do so here

Lots of info about the config files on the original project page here


Nice job haxy. :smile:

1 Like

Hey. I like the plugin, and I used to use Pwnfilter for craftbukkit as well. But, do you think you could include a list of commands for the filter configuration, and perhaps a guide? It’s not that “easy” to get into. For example, I don’t know how to replace a bad word with “***”, as it is not in any of the .txt files. I think this would make it more user-friendly for many people =)

1 Like

Thank you, that helped. However, whenever I try to replace a word with anything else, the new characters gets put in between every other character, including the username, even if there’s no match. Is there a way to fix this?
Screenshot MCchat:
Screenshot Chat.txt:

That means there’s something wrong with your regex. Every single character triggers a match :wink:

Well, I’m not sure if bug-posting is allowed in here, so correct me if it’s not =)
But, I wanna share something interesting. I reinstalled the plugin and it solved the whole “x” between all characters thing. Not sure what was wrong. Anyhow, editing the pwnfilter.conf and setting “logfile=false” prevents the plugin from working at all.

Also, using the “then replace” function means that the characters “rr” is added after every username whenever a word matches. This also goes for the “then rewrite” function.

Is there a place where I can read on how to use the \b, \s and so on? I went through your tutorial and the bukkit link you sent, and couldn’t find it anywhere. I found out that \b excludes stuff that goes before or after a word and allows the filtered word through in that case. But what are the other options for, and how many are there?

Thank you for answering my questions btw.

When doing Regex, I usually both make and test it on before I add it on my server. It also has an overview of the regex operators, and gives you a breakdown of how your current statement works.

Thank you for that Lemonous =)

Also, found out that having ANY extra “|” in the chat.txt makes the “then replace x” get in between every single character. For example, if the chat.txt contains the line “match crap|” it will cause it, or if the line reads “match crap||damn” that will also cause it. Maybe exceptions for that can be added in the code for the plugin itself? It would prevent a lot of frustration for users I think.

As for the extra “rr” after usernames, that has to be a bug in the plugin I think.

That would most likely be because the “|” is the OR operator. Since you have nothing after the operator in “crap|”, I assume the empty part is read as any character. The same goes for the “empty string” between || :slight_smile:

Some out of my personal filter :wink:

# (S17) Match: fuck, fcuk, fuq, fck
match (?<!'|\w)(f+(\W|_)*u+)(?!\w)|(f+(\W|_)*u+(\W|_)*(c|k)+)|(?<!'|\w)(f+(\W|_)*(3|e)+(\W|_)*(c|k)+(\W|_)*(c|k)+(\W|_)*i*(\W|_)*n*(\W|_)*g*)(?!\w)|(?<!'|\w)(f+(\W|_)*u+(\W|_)*g+(\W|_)*(1|l)+(\W|_)*y+)(?!\w)|(?<!'|\w)(f+(\W|_)*v+(\W|_)*(c|k)+(\W|_)*(c|k)+)|(f+(\W|_)*u+(\W|_)*x+(\W|_)*r+)|(f+(\W|_)*c+(\W|_)*u+(\W|_)*k+(\W|_)*)|(f+(\W|_)*u+(\W|_)*q+(\W|_)*\w*)|(f+(\W|_)*c+(\W|_)*k+(\W|_)*\w*)
ignore string afk
then randrep frick|frack|ferk|ferp|derp
#then console say &player Violated Rule (S17)
#then log
# (S11) Match: clit, cunt, cnts, slit, slut
match (?<!'|\w)((c|k|s)+(\W|_)*(1|l)+(\W|_)*(1|i|u|v)+(\W|_)*(7|t)+(\W|_)*\w*)|(?<!'|\w)((c|k)+(\W|_)*u+(\W|_)*n+(\W|_)*(7|t)+\w*)|(?<!'|\w)(c+(\W|_)*n+(\W|_)*t+(\W|_)*s+)(?!\w)
then replace fun
#then console say &player Violated Rule (S11)
#then log
match (i hate|fuck)+ this server|this server is (shit|crap)+|server sucks
rule HS3 Server Hating
then replace This server is great!
# then console ban %player% Server Hating.
then log
# NOTE: You could also use a command from a ban manager, eg:
# then console tempban %player% 7d %ruleid% (%rawstring%)
# Step Grammar nazi

# Match: anyone 'got' to have
match (?<=(any(one|body)|I) )got(?!\w|\son\s)
then rewrite have

# Match: how much ... have add ?
match (?<=how much ((.){1,40})have)(?!\?)
then rewrite ?

# Match: who what when where why alone add ?
#match ^(W|w)h(o|at|en|ere|y)$
#then rewrite %string%?

As for the r bug, i havnt spotted it in testing, can you pastebin your rules file?

Pastebin of chat.txt :

My command.txt, console.txt and sign.txt are all unedited.
Thank you for your examples btw, I’m gonna see if I can make sense of some of the more complicated parts :stuck_out_tongue:

Edit: Forgot to mention this. If you write normally, the rr doesn’t appear. For example, my username is Axel_Hamsen, so whenever I write “hey” it just comes up as “>Axel_Hamsen> hey”, but when I write “ass” for example, it comes up as “>Axel_Hamsenrr> ***”
(Used > both times, because this website hides text when it’s pointing to the left, lol)

Edit: I figured out that the “rr” is caused because I have the sponge version of EssentialCmds running at the same time. If I remove that, this plugin works perfectly fine.

Is there something special I have to do to get the blocked commands to work?
None of the commands listed in the command file are blocked for any players.

1 Like

Zorock> Edit: I figured out that the “rr” is caused because I have the sponge version of EssentialCmds running at the same time. If I remove that, this plugin works perfectly fine.

So are you planning to fix the compatibility issues with PwnFilter and EssentialCmds? It doesn’t really look clean in the chat output at the moment. :smile:

Looking forward to see this mod flourish. Thanks for the work so far!

Pastebin of Chat.txt

Screenshot of output

it’s already fixed in repo, I just havnt got round to releasing a build yet

1 Like

Your issue tracker on github is disabled, so I guess I have to post this here…

on startup on sponge api v4 1212 I get this with all default files-

[07:34:29] [Server thread/INFO] [pwnfilter]: Now logging to config/pwnfilter/pwnfilter.log
[07:34:29] [pool-3-thread-2/ERROR] [Sponge]: The Scheduler tried to run the task pwnfilter-A-4 owned by org.spongepowered.mod.plugin.SpongeModPluginContainer@32a2209b, but an error occured.
java.lang.NoSuchMethodError: org.spongepowered.api.plugin.PluginContainer.getVersion()Ljava/lang/String;
at com.pwn9.PwnFilter.minecraft.util.Metrics.postPlugin( ~[Metrics.class:?]
at com.pwn9.PwnFilter.minecraft.util.Metrics.access$400( ~[Metrics.class:?]
at com.pwn9.PwnFilter.minecraft.util.Metrics$ ~[Metrics$1.class:?]
at org.spongepowered.api.scheduler.Task$Builder.lambda$execute$10( ~[Task$Builder.class:1.8.9-1763-4.1.0-BETA-1212]
at org.spongepowered.common.scheduler.SchedulerBase.lambda$startTask$69( ~[SchedulerBase.class:1.8.9-1763-4.1.0-BETA-1212]
at java.util.concurrent.Executors$ [?:1.8.0_71]
at [?:1.8.0_71]
at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:1.8.0_71]
at java.util.concurrent.ThreadPoolExecutor$ [?:1.8.0_71]
at [?:1.8.0_71]
[07:34:29] [Server thread/INFO] [pwnfilter]: Activated SignListener with Priority Setting: LAST Rule Count: 3
[07:34:29] [Server thread/INFO] [pwnfilter]: Activated CommandListener with Priority Setting: LAST Rule Count: 7
[07:34:29] [Server thread/INFO] [pwnfilter]: Activated PlayerListener with Priority Setting: LAST Rule Count: 3

I don’t know anything about coding, so getting this to work has been impossible, there’s nothing to work off of…

Apparently you didn’t click the link to the old version which is full of information on that…

Funny, I tried the exact code and it didn’t do anything different in chat :stuck_out_tongue_winking_eye: I also tried one someone else posted in this thread but, like I said-I know nothing about code, so if there’s something else needing to be done I’m not sure what it is.

Edit: It really is an awesome plugin, I was really hoping this exact thing existed-but as is, us common folk don’t seem to be able to get it working. Maybe a tutorial or something would be helpful?

Please update to the 4.0 Sponge api? See my error in the prior post, perhaps that error isn’t related to the api.