fix(commands): repair Bedrock command completion - #427
Closed
AlexProgrammerDE wants to merge 1 commit into
Closed
AlexProgrammerDE wants to merge 1 commit into
AlexProgrammerDE wants to merge 1 commit into
Conversation
The Java client cancels earlier server suggestion requests when sibling arguments all ask for completion. Emit fixed singleton enum values as literals and mark only one sibling for server suggestions so the proxy can merge the results. Keep canonical command names and aliases, consume target arguments, and preserve optional root execution and player visibility when building the Java command tree.
AlexProgrammerDE
marked this pull request as draft
September 25, 2026 10:05
AlexProgrammerDE
marked this pull request as ready for review
September 25, 2026 10:11
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.
What failed
In a live Java 26.3 client,
/timearrived as three sibling argument nodes:TimeModeAdd,TimeModeSet, andTimeModeQuery. Each node usedminecraft:ask_server. The Java client cancels the previous server suggestion request when another sibling makes one, while Brigadier waits for all sibling results. This leaves/time swithout completion. The proxy itself returnedsetfor/time s, so the value was present before translation.The Bedrock Available Commands packet describes command names, aliases, overloads, and enum values. We turn that data into a Java Brigadier tree. The changes below address separate errors in that translation.
Why each change is here
/timeoverload has a fixed mode such asset. A literal lets the Java client completeslocally and distinguish the overloads without three server requests. The conversion excludes soft enums, constrained enums, and values with whitespace. Those values need an argument node because they can change, have visibility rules, or cannot form one Brigadier literal.ask_serverprovider per group of sibling arguments. The client packet carries one provider marker, while the proxy's Brigadier tree keeps every provider. One client request callsCommandsStorage.complete. The proxy collects suggestions from the applicable siblings and sends the combined result. This avoids cancellation for commands that still need server suggestions.HashMapcan give two distinct nodes the same packet index when their structure matches.IdentityHashMapkeeps indices tied to the actual nodes referenced by child and redirect edges. The set of nodes marked for server suggestions uses identity for the same reason. This protects tree serialization. It was not the observed cause of/time s.HIDDEN_FROM_PLAYERon its own. The Java tree belongs to a player. The old filter hid a command only when the player, command block, and automation flags were all set. A command hidden from players can still be available to command blocks or automation, so those flags do not decide player visibility.TargetArgumentType.parsepreviously returned without advancing the cursor. The proxy could not reach a following argument or its suggestions. It now consumes a player name or selector, including quoted spaces inside selector brackets, and stops at the next argument separator. It rejects empty tokens and unclosed quotes or selector brackets. The Bedrock server still validates the target syntax when the command runs.Verification
./gradlew compileJava checkstyleMain --no-daemonpassed.git diff --checkpassed.nextafter@e[name="two words"] n.The patched jar has not been loaded into the running client and proxy, so the in-game result still needs verification.
Remaining work
This PR does not complete every Bedrock command grammar. The decoder discards command-level chained subcommand indexes. The tree builder skips chained subcommand parameters and postfixes, and an enum-as-chained-command parameter still throws. These need representative packet data and a separate grammar translation. Generic ID arguments also have no Bedrock-specific value suggestions.