Skip to content

Add Chat Formatting Support For Servers#1483

Merged
codeHusky merged 8 commits intoMCLCE:mainfrom
DrPerkyLegit:main
Apr 13, 2026
Merged

Add Chat Formatting Support For Servers#1483
codeHusky merged 8 commits intoMCLCE:mainfrom
DrPerkyLegit:main

Conversation

@DrPerkyLegit
Copy link
Copy Markdown
Contributor

Description

adding chat formatting for servers

Changes

Previous Behavior

chat wouldnt render html formatting
servers had no support for localization in messages
image_2026-04-06_223315531

Root Cause

it just wasnt needed for p2p clients, chat was never added so they never bothered with the extra features

New Behavior

the opposite of Previous Behavior except its sent from a server message, tested with fourkit as its designed for a server to send the message
image_2026-04-06_223403262
image_2026-04-06_223513047

Fix Implementation

changes the chat labels to be html based so it can render html formatting
added support for multiple argument chat messages that also support formatting (this part is designed for the server, no default client access)
changed player messages to use < and > for <> because it breaks when using html labels

AI Use Disclosure

i used ai to get the regex pattern cause i dont know how to make those honestly

Related Issues

@sylvessa
Copy link
Copy Markdown
Contributor

sylvessa commented Apr 7, 2026

i feel like all chats should have color processing, as this would require server owners to send custom chat packets to have custom chat colors for when a player talks.

https://www.youtube.com/watch?v=JbNUi6sNOeM in 1.1 its shown you could even put colroed chat as a player, but required a mod to put the section symbols
https://minecraft.wiki/w/Java_Edition_1.1#Gameplay_2 also referenced here

in bukkit, you can simply just replace the text sent by a player with section symbols for it to show color, i feel that should be doable without having to send a custom packet etc, all you should have to do is modify the actual text in the packet and it have the color codes and it process normally

@DrPerkyLegit
Copy link
Copy Markdown
Contributor Author

currently i do it this way cause it didnt seem like something that would want to be added to non dedicated server chats but its possible to change, i would also suggest that doing it that way we update the max char limit to only be based on displayed chars (i will code this) so that the chat colors dont cause the string to hit the 123 max without actually displaying that many characters

@codeHusky codeHusky self-assigned this Apr 9, 2026
has a bug where the text after the cursor gets stripped of its color, need to make a function to backstep on a string and find the last used color codes, or get all color codes used before the string is split, and apply them to the start of the next string
@DrPerkyLegit
Copy link
Copy Markdown
Contributor Author

changed chat color to use the double s, client can send color, color doesnt effect chat message length (needs to be improved), html escaping the message to prevent any html parse exploits

@DrPerkyLegit
Copy link
Copy Markdown
Contributor Author

DrPerkyLegit commented Apr 10, 2026

currently it only supports the basic color codes and the old translateables i showed, no bold / italics / corrupted text styling, something i plan on attempting to add, doesnt support multi argument messages anymore, clients can only send 100 characters (not including color codes), all messages cap at 255 regardless of color codes (i noticed a crash with large messages, client freezes and doesnt trigger the debugger)

@DrPerkyLegit
Copy link
Copy Markdown
Contributor Author

DrPerkyLegit commented Apr 10, 2026

image image

@DrPerkyLegit
Copy link
Copy Markdown
Contributor Author

prevented players from sending color but not the server as requested
image

@codeHusky
Copy link
Copy Markdown
Contributor

@DrPerkyLegit Could you resolve the merge conflict? Occurred after merging the chat scroll feature

@DrPerkyLegit
Copy link
Copy Markdown
Contributor Author

done

@codeHusky codeHusky merged commit 14f8d79 into MCLCE:main Apr 13, 2026
1 check passed
itsRevela pushed a commit to itsRevela/LCE-Revelations that referenced this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants