Allow commands with xbox achievements enabled (#4894)

* Allow commands with xbox achievements enabled

* Don't enable by default

* Add null check to paramData

* Update comment
This commit is contained in:
rtm516 2024-07-31 01:06:26 +01:00 committed by GitHub
parent ca0f3775a2
commit 13dfc7c173
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -169,8 +169,8 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
return;
}
// The command flags, not sure what these do apart from break things
Set<CommandData.Flag> flags = Set.of();
// The command flags, set to NOT_CHEAT so known commands can be used while achievements are enabled.
Set<CommandData.Flag> flags = Set.of(CommandData.Flag.NOT_CHEAT);
// Loop through all the found commands
for (Map.Entry<BedrockCommandInfo, Set<String>> entry : commands.entrySet()) {
@ -449,7 +449,7 @@ public class JavaCommandsTranslator extends PacketTranslator<ClientboundCommands
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)) {
if (optional && type == CommandParam.MESSAGE && paramData != null && (paramData.getType() == CommandParam.STRING || paramData.getType() == CommandParam.TARGET)) {
optional = false;
}
}

View file

@ -168,7 +168,6 @@ above-bedrock-nether-building: false
force-resource-packs: true
# Allows Xbox achievements to be unlocked.
# THIS DISABLES ALL COMMANDS FROM SUCCESSFULLY RUNNING FOR BEDROCK IN-GAME, as otherwise Bedrock thinks you are cheating.
xbox-achievements-enabled: false
# Whether player IP addresses will be logged by the server.