Fix chat submission closing screens opened by commands - #6646
Closed
Eccys wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Preserve screens opened by client commands when the chat input is submitted.
Typing
.reconnectwith Meteor Rejects installed exposes the problem: the command opens aConnectScreensynchronously, butChatScreen.keyPressed()then continues and unconditionally callsGui.setScreen(null). The new connection screen is replaced before it can continue ticking through the connection process.The command itself belongs to Meteor Rejects. Meteor dispatches client commands synchronously from
ClientPacketListener.sendChat, so the screen replacement happens inside the original chat submission. The same problem applies to other commands that open a screen immediately.Wrap the chat-close call with a condition that the current screen is still the submitting chat screen. Normal chat submission still closes chat. If a command has opened a connection screen, another chat screen, or any other screen, that screen stays open. The keep-chat-open path is unchanged.
Related issues
No existing issue found for this chat-submission problem.
How Has This Been Tested?
./gradlew build --no-daemonpasses on Java 25 against the current Minecraft 26.2 target. The build has no existing automated test sources.onCloseChatguard with minimal UI doubles. Six scenarios were run before and after the guard: ordinary chat, a replacement screen, another chat screen, a command that already closed chat, keep-open chat, and keep-open chat with a replacement screen. All 12 checks passed; the baseline reproduced the screen overwrite and the guarded path preserved replacements. The harness also checked the compiled injection target and that vanilla has exactly one matching close call.Checklist: