mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Bump Protocol version to fix command suggestions
Fix assert that occurs on Bedrock after typing /
This commit is contained in:
parent
cbba0d3a75
commit
f79a3ef2f7
2 changed files with 9 additions and 3 deletions
|
@ -121,7 +121,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
||||
<artifactId>bedrock-beta</artifactId>
|
||||
<version>49323e0</version>
|
||||
<version>51d4fce</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
|
|
@ -248,7 +248,7 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||
/**
|
||||
* Stores the command description and parameter data for best optimizing the Bedrock commands packet.
|
||||
*/
|
||||
private static record BedrockCommandInfo(String description, CommandParamData[][] paramData) {
|
||||
private record BedrockCommandInfo(String description, CommandParamData[][] paramData) {
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
@ -317,15 +317,21 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||
Object mappedType = mapCommandType(session, paramNode);
|
||||
CommandEnumData enumData = null;
|
||||
CommandParam type = null;
|
||||
boolean optional = this.paramNode.isExecutable();
|
||||
if (mappedType instanceof String[]) {
|
||||
enumData = new CommandEnumData(paramNode.getParser().name().toLowerCase(), (String[]) mappedType, false);
|
||||
} else {
|
||||
type = (CommandParam) mappedType;
|
||||
// Bedrock throws a fit if an optional message comes after a string or target
|
||||
// Example vanilla commands: ban-ip, ban, and kick
|
||||
if (optional && type == CommandParam.MESSAGE && (paramData.getType() == CommandParam.STRING || paramData.getType() == CommandParam.TARGET)) {
|
||||
optional = false;
|
||||
}
|
||||
}
|
||||
// IF enumData != null:
|
||||
// In game, this will show up like <paramNode.getName(): enumData.getName()>
|
||||
// So if paramNode.getName() == "value" and enumData.getName() == "bool": <value: bool>
|
||||
children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), this.paramNode.isExecutable(), enumData, type, null, Collections.emptyList())));
|
||||
children.add(new ParamInfo(paramNode, new CommandParamData(paramNode.getName(), optional, enumData, type, null, Collections.emptyList())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue