3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 00:23:03 +01:00

Bump Protocol version to fix command suggestions

Fix assert that occurs on Bedrock after typing /
Dieser Commit ist enthalten in:
davchoo 2022-05-29 18:56:54 -04:00
Ursprung cbba0d3a75
Commit f79a3ef2f7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A0168C8E45799B7D
2 geänderte Dateien mit 9 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -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>

Datei anzeigen

@ -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())));
}
}