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:
Ursprung
cbba0d3a75
Commit
f79a3ef2f7
@ -121,7 +121,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
<groupId>com.github.CloudburstMC.Protocol</groupId>
|
||||||
<artifactId>bedrock-beta</artifactId>
|
<artifactId>bedrock-beta</artifactId>
|
||||||
<version>49323e0</version>
|
<version>51d4fce</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<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.
|
* 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
|
@Getter
|
||||||
@ -317,15 +317,21 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
|
|||||||
Object mappedType = mapCommandType(session, paramNode);
|
Object mappedType = mapCommandType(session, paramNode);
|
||||||
CommandEnumData enumData = null;
|
CommandEnumData enumData = null;
|
||||||
CommandParam type = null;
|
CommandParam type = null;
|
||||||
|
boolean optional = this.paramNode.isExecutable();
|
||||||
if (mappedType instanceof String[]) {
|
if (mappedType instanceof String[]) {
|
||||||
enumData = new CommandEnumData(paramNode.getParser().name().toLowerCase(), (String[]) mappedType, false);
|
enumData = new CommandEnumData(paramNode.getParser().name().toLowerCase(), (String[]) mappedType, false);
|
||||||
} else {
|
} else {
|
||||||
type = (CommandParam) mappedType;
|
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:
|
// IF enumData != null:
|
||||||
// In game, this will show up like <paramNode.getName(): enumData.getName()>
|
// In game, this will show up like <paramNode.getName(): enumData.getName()>
|
||||||
// So if paramNode.getName() == "value" and enumData.getName() == "bool": <value: bool>
|
// 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())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren