Closed MrRubberDucky closed 2 years ago
I can't fix it right now, but with replacement letters, while it says its incorrect, if you use the command it still works. I will do a lot more work and try to fix all of this tonight. Command I used:
/filter config replacementLetters add @ a
As with regex, personally I did not have a lot of experience with it, but that's no excuse and I will make sure that I fix that.
I can't fix it right now, but with replacement letters, while it says its incorrect, if you use the command it still works. I will do a lot more work and try to fix all of this tonight. Command I used:
/filter config replacementLetters add @ a
As with regex, personally I did not have a lot of experience with it, but that's no excuse and I will make sure that I fix that.
Ah thanks for telling me that it still works. Also, no rush. Take your time!
About to test a fix for not serializing the charargumenttype, but I have a question regarding making sure regexes are not garbage. If I were to put something random, I don't see how the regex could be invalid. Example:
It may not be optimal or a good practice but I don't see a practical way to rule regexes out as faulty.
Then that's fine, didn't realize regex can take everything and be fine with it so that's on me.
I've figured out what was wrong with the regex, ends up the method I was using had a different format (so technically it did work, just wasn't really optimal). And I'll be switching it out for something more traditional.
What I said above comment is actually incorrect, the reason regex wasn't working was because when checking messages, the playername section was left on. For example, if the message was <Player> baas
, it would not fit the regex (?i)b(?:aa|ss)s$
. To correct for this I added in some code to remove names ahead of time. When testing regex, I used .*\btesting\b.*
which ignored the playername.
When making the replacementLetters command, I had to write my own command argument. What I ended up with is a CharArgumentType. Upon testing in a single player world I noticed no issues because the mod was on the client. The way the client works it is by running the parse method on every change and the server parses it when it's run. Since there is no argument on the client it just marks it wrong. From what I've seen, there is no way to fix it without installing Chat Control on the client (I do plan to eventually make chat control compatible with clients though). Since there is not much I can do here, I will just add a disclaimer in the mod descriptions.
The issue here was that I forgot to register the argument in minecraft's registry. I have since done it, but it doesn't make a huge difference as the client doesn't have the CharArgumentType code anyways.
A new update will be coming out soon!
The regex works but with a small nitpick and it's that if you're using a custom chat styling mod like Styled Chat and change ">" to let's say "»" for example, the RegEx filtering stops working but word filtering and character filtering still seems to work just fine. Here's a example:
Aside from that, thanks for the update! It's super helpful being able to reload config on the fly and stuff 👍
No problem, what I might do is make another config option on where to cut off the name or increase priority and check messages before other chat mods can get to them, glad I could help though.
Alright, since this is solved imma close the issue.
Well I tried to add a regex in many ways, adding ", yeeting ()'s, removing []'s and so on and so on and yet the result is always the same.
Here's a example regex I made that targets words bsss and baas while also being case insensitive: (?i)b(?:aa|ss)s$ Expected result would be for Chat Control to filter the message if a match happens but instead it still lets the message through as if the regex does nothing, yet when validating in another self-made java application or some online site, the regex works perfectly. The command /filter add regex also accepts anything, even total garbage and doesn't validate the input so I can just do /filter add regex asfdsfjdsf and it will save it in and say it was added successfully.
Not sure if related but here are some errors, not sure why but maybe it is because I have some letters with numbers in them, once again there's no input validation to really tell you that you shouldn't put numbers in there so for someone that doesn't know it might actually confuse someone
replacementLetters option (/filter config replacementLetters) just keeps saying Incorrect Argument for command, no matter how I put stuff in there it seems like it doesn't seem to change much.
also thanks for making this a thing, I actually needed something like this for my server