TwelveIterationMods / ChatTweaks

Minecraft Mod. Emoticons, Image Preview, Tabs and Filters. Client-side only.
https://mods.twelveiterations.com/mc/chat-tweaks/
MIT License
18 stars 10 forks source link

[Question}Checking formatting codes? #63

Open rayblon opened 5 years ago

rayblon commented 5 years ago

Heyo. I've been trying to use formatting codes to detect otherwise highly variable messages sent to the client -- messages from magicspells and otherwise, where the only thing they have in common is the formatting codes prefixing them. How do you detect the formatting codes, or is it not currently possible?

BlayTheNinth commented 5 years ago

I think currently it is possible and should just work as normal (see https://minecraft.gamepedia.com/Formatting_codes) - however, formatting codes being present in filter checks is actually a bug that is going to be fixed in the Minecraft 1.13/1.14 port (see #47).

Starting then, the only way to detect those kind of messages would be by defining them in the filter one-by-one, or through a separate addon that bundles those kind of messages to a specific channel (kinda like the system/action messages channels provided by Chat Tweaks right now).

rayblon commented 5 years ago

I see. Would it be easy to implement a toggle that lets you detect formatting codes? I'm asking because I'm working with a server to tailor a bunch of system messages to be easily sorted with this mod, and we wanted to use strings of formatting codes as invisible sorting tags.

BlayTheNinth commented 5 years ago

I think what I will do is to keep the formatting codes in as long as the formatting code character ("§") appears in the filter.

Which reminds me, I'm not sure if you can type the character in the GUI, since Minecraft is really weird about it. You may have to manually edit the views.json file to add it to the filter.

rayblon commented 5 years ago

Yeah, though adding it to the JSON directly causes a crash, and the escape code \u00A7 added to the config doesn't seem to translate into the character, from what I've seen