Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mixin for longer chat messages #252

Merged
merged 20 commits into from
Nov 5, 2023
Merged

Add mixin for longer chat messages #252

merged 20 commits into from
Nov 5, 2023

Conversation

serenibyss
Copy link
Member

@serenibyss serenibyss commented Sep 21, 2023

Adds a two class mixin to allow raising the chat message length limit up to (currently) 512. Newer versions of Minecraft raised this limit to 256, so that is what I chose as the default value. The 512 limit is arbitrary, and I'm not sure if there are larger implications of it being this high, or if it could be higher.

I'm not the most familiar with mixin, so please let me know if there is any problems with remapping especially since I used a deobfuscated name in two of the mixin targets.

@boubou19
Copy link
Member

boubou19 commented Sep 21, 2023

what happens if server and client have different values? Or if 2 clients haven't the same value?

@serenibyss
Copy link
Member Author

what happens if server and client have different values? Or if 2 clients haven't the same value?

This is a problem, as if the server's value is smaller than the client, and the client sends a message that's too long, it will kick the client from the server. I think there's 2 different approaches to handling it, either just force the chat length to 256 like newer Minecraft versions (or some other agreed upon number), or somehow synchronize the server config value to the client on join (not sure how easy this is)

@boubou19
Copy link
Member

imo best would be for clients to be able to automatically break down chat messages into multiple ones if they have a value below the server one

@Alexdoru
Copy link
Member

what happens if server and client have different values? Or if 2 clients haven't the same value?

there is no problem if two clients have different values, but it will shorten the message to the server value if the server and client have different values

@Alexdoru
Copy link
Member

what happens if server and client have different values? Or if 2 clients haven't the same value?

This is a problem, as if the server's value is smaller than the client, and the client sends a message that's too long, it will kick the client from the server. I think there's 2 different approaches to handling it, either just force the chat length to 256 like newer Minecraft versions (or some other agreed upon number), or somehow synchronize the server config value to the client on join (not sure how easy this is)

imo should just remove the config option to choose the lenght and hardcode it to 256

@Alexdoru
Copy link
Member

Adds a two class mixin to allow raising the chat message length limit up to (currently) 512. Newer versions of Minecraft raised this limit to 256, so that is what I chose as the default value. The 512 limit is arbitrary, and I'm not sure if there are larger implications of it being this high, or if it could be higher.

I'm not the most familiar with mixin, so please let me know if there is any problems with remapping especially since I used a deobfuscated name in two of the mixin targets.

I pushed two commits to correct your pr

@Dream-Master Dream-Master requested review from a team September 21, 2023 14:42
@Alexdoru
Copy link
Member

I'm ok with this now if anyone else wants to look at it

@Dream-Master Dream-Master dismissed Alexdoru’s stale review September 24, 2023 02:38

You said you ok with it

@Dream-Master
Copy link
Member

@serenibyss

@serenibyss
Copy link
Member Author

If the server has the setting off, and a client joins with the setting on, it would still disconnect the player if an oversized message is sent

@Dream-Master
Copy link
Member

@serenibyss are there any way to fix it?

@Dream-Master
Copy link
Member

@serenibyss can you resolve the conflict?

@Dream-Master Dream-Master requested a review from a team October 28, 2023 15:01
Dream-Master and others added 2 commits November 3, 2023 18:33
The config option now just controls whether the client can send longer messages, which most people wont disable.
Copy link
Contributor

github-actions bot commented Nov 3, 2023

Warning: 2 uncommitted changes
#274

@Caedis Caedis requested a review from Alexdoru November 3, 2023 18:42
@Caedis Caedis requested a review from Alexdoru November 4, 2023 19:05
@Caedis
Copy link
Member

Caedis commented Nov 4, 2023

I believe that is the proper way to add config syncing.
Logged on the sp dev world and I could send messages > 100 characters.
Logged on the dev server with the server's config being false and the clients being true and watched it sync the value.
That then prevented sending a message over 100 characters.

This should also allow for future (or current) config options to be synced.

@Caedis Caedis enabled auto-merge (squash) November 4, 2023 19:30
@Alexdoru
Copy link
Member

Alexdoru commented Nov 4, 2023

Since I never worked with custom packets, I can't review that PR sorry, but I am glad you could figure it out :p

@Caedis Caedis dismissed Alexdoru’s stale review November 5, 2023 02:50

Implemented and approved changes by miozune

@Caedis Caedis merged commit 727d0dc into master Nov 5, 2023
@Caedis Caedis deleted the sb-longer-chat-messages branch November 5, 2023 02:50
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.

7 participants