Insprill / custom-join-messages

Feature-packed plugin for handling all join and quit notifications on Spigot/Paper servers
https://modrinth.com/plugin/custom-join-messages/
GNU General Public License v3.0
10 stars 0 forks source link

Placeholder hex color bug #42

Closed SimplyJeevS closed 1 year ago

SimplyJeevS commented 1 year ago

Server Version

paper 1.19.3 #448

CJM Version

17.2.2

Describe the Bug

A bug in the hex color formatting where placeholders hex colors that use a legacy formatter like &l will add the "l" in this case before the prefix because it doesn't get parsed properly (and wont apply the bold effect in this case). I have helped another dev resolve this issue and I'm assuming its the same issue here since it is the exact same problem. here is a link to the commit that fixed it https://github.com/Nicholas-Vo/PictureLogin-Continued/commit/fe59e1e5f45562a5eb410d4eff3ea2c425a82699 Edit: I had a quick look and it seem like the fault is in the way you either format lien 11 or 12 in LegacyFormatter.kt again look at the example i provided above and it will be a 1 minute fix!

Expected Behavior

The text is supposed to format the text after the color change. In my case making it bold.

Steps to Reproduce

  1. Have a vault prefix which contains a hex color and a legacy formatter like &l. (This is my current format "&#fdafef&lᴏᴡɴᴇʀ")
  2. Add this prefix in the join message.
  3. And it will then show up when you join/leave.

Server Logs

This is not necessary as it doesn't show up as an error in logs.

Additional Information

If you need any help or it is not exactly the same issue as this other developer had, feel free to hit me up to brainstorm. Great plugin in general

Checklist

Insprill commented 1 year ago

The legacy formatter works fine, however this exact behaviour occurs when using the Minedown formatter. Restart the server after changing formatters to make sure it applies. You can read the wiki page for more information about formatters in CJM.

SimplyJeevS commented 1 year ago

I'm not using the Minedown formatter tho, like I said this exact same issue happened in another plugin. This can be easily fixed by changing the way your legacy formatter interacts with hex codes. The issue is when a vault prefix that works perfect everywhere else gets used with custom join messages, The prefix look like this "&#fdafef&lᴏᴡɴᴇʀ" so as you can see its all legacy formatting. All I can do is refer you to the link I send in my initial issue. That plugin had the exact same issue and behavior and was easily fixed. If I could change the formatting of my prefixes I would but I cant it only takes legacy formatting. Edit: As some extra detail this wont happen with just hex colors or legacy colors with formatters, only with hex colors mixed with legacy formatters.

SimplyJeevS commented 1 year ago

Didn't mean to close it oops.

Insprill commented 1 year ago

When using the legacy formatter and setting the message to &#fdafef&lᴏᴡɴᴇʀ, I get the following result image

When using the Minedown formatter with the same message, I get the issue you're having, because it's not the proper Minedown syntax. image

Make sure you've set formatting.formatter to LEGACY in the config, and restart your server for good measure. If you're still having the issue, zip up your config folder and send it for me to look into.

SimplyJeevS commented 1 year ago

You are right, that's my bad, it just seems like a shame you cant use any placeholders with legacy formatters with Minedown. Do you think it would be possible to add an exception in the module where you handle placeholders to scan for legacy formatters. And it either converts the placeholder to Minedown formatting? Again my bad for being so persistent and blind!

Insprill commented 1 year ago

That's not possible, unfortunately. 17.2.3 will use the legacy formatter by default though to reduce confusion.