Skip to content

Commit 13dfc7c

Browse files
authored
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
1 parent ca0f377 commit 13dfc7c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaCommandsTranslator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ public void translate(GeyserSession session, ClientboundCommandsPacket packet) {
169169
return;
170170
}
171171

172-
// The command flags, not sure what these do apart from break things
173-
Set<CommandData.Flag> flags = Set.of();
172+
// The command flags, set to NOT_CHEAT so known commands can be used while achievements are enabled.
173+
Set<CommandData.Flag> flags = Set.of(CommandData.Flag.NOT_CHEAT);
174174

175175
// Loop through all the found commands
176176
for (Map.Entry<BedrockCommandInfo, Set<String>> entry : commands.entrySet()) {
@@ -449,7 +449,7 @@ public void buildChildren(CommandBuilderContext context, CommandNode[] allNodes)
449449
type = (CommandParam) mappedType;
450450
// Bedrock throws a fit if an optional message comes after a string or target
451451
// Example vanilla commands: ban-ip, ban, and kick
452-
if (optional && type == CommandParam.MESSAGE && (paramData.getType() == CommandParam.STRING || paramData.getType() == CommandParam.TARGET)) {
452+
if (optional && type == CommandParam.MESSAGE && paramData != null && (paramData.getType() == CommandParam.STRING || paramData.getType() == CommandParam.TARGET)) {
453453
optional = false;
454454
}
455455
}

core/src/main/resources/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ above-bedrock-nether-building: false
168168
force-resource-packs: true
169169

170170
# Allows Xbox achievements to be unlocked.
171-
# THIS DISABLES ALL COMMANDS FROM SUCCESSFULLY RUNNING FOR BEDROCK IN-GAME, as otherwise Bedrock thinks you are cheating.
172171
xbox-achievements-enabled: false
173172

174173
# Whether player IP addresses will be logged by the server.

0 commit comments

Comments
 (0)