Add config option for enabling achievements (#1504)

* Add config option for enabling achievements

* Disabled achievements by default and added warning about commands being disabled

* Update config.yml

* Rename achievements-enabled to xbox-achievements-enabled for clarity

Co-authored-by: Camotoy <20743703+DoctorMacc@users.noreply.github.com>
This commit is contained in:
rtm516 2020-11-07 00:52:09 +00:00 committed by GitHub
parent 0e15aa7441
commit a6cc28ee80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View file

@ -81,6 +81,8 @@ public interface GeyserConfiguration {
boolean isForceResourcePacks(); boolean isForceResourcePacks();
boolean isXboxAchievementsEnabled();
int getCacheImages(); int getCacheImages();
IMetricsInfo getMetrics(); IMetricsInfo getMetrics();

View file

@ -107,6 +107,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("force-resource-packs") @JsonProperty("force-resource-packs")
private boolean forceResourcePacks = true; private boolean forceResourcePacks = true;
@JsonProperty("xbox-achievements-enabled")
private boolean xboxAchievementsEnabled = false;
private MetricsInfo metrics = new MetricsInfo(); private MetricsInfo metrics = new MetricsInfo();
@Getter @Getter

View file

@ -634,7 +634,7 @@ public class GeyserSession implements CommandSender {
startGamePacket.setLevelGameType(GameType.SURVIVAL); startGamePacket.setLevelGameType(GameType.SURVIVAL);
startGamePacket.setDifficulty(1); startGamePacket.setDifficulty(1);
startGamePacket.setDefaultSpawn(Vector3i.ZERO); startGamePacket.setDefaultSpawn(Vector3i.ZERO);
startGamePacket.setAchievementsDisabled(true); startGamePacket.setAchievementsDisabled(!connector.getConfig().isXboxAchievementsEnabled());
startGamePacket.setCurrentTick(-1); startGamePacket.setCurrentTick(-1);
startGamePacket.setEduEditionOffers(0); startGamePacket.setEduEditionOffers(0);
startGamePacket.setEduFeaturesEnabled(false); startGamePacket.setEduFeaturesEnabled(false);
@ -645,7 +645,7 @@ public class GeyserSession implements CommandSender {
startGamePacket.getGamerules().add(new GameRuleData<>("showcoordinates", true)); startGamePacket.getGamerules().add(new GameRuleData<>("showcoordinates", true));
startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC); startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC); startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setCommandsEnabled(true); startGamePacket.setCommandsEnabled(!connector.getConfig().isXboxAchievementsEnabled());
startGamePacket.setTexturePacksRequired(false); startGamePacket.setTexturePacksRequired(false);
startGamePacket.setBonusChestEnabled(false); startGamePacket.setBonusChestEnabled(false);
startGamePacket.setStartingWithMap(false); startGamePacket.setStartingWithMap(false);

View file

@ -117,6 +117,11 @@ above-bedrock-nether-building: false
# want to download the resource packs # want to download the resource packs
force-resource-packs: true force-resource-packs: true
# Allows Xbox achievements to be unlocked.
# This disables certain commands so the Bedrock client can't to "cheat" to get them.
# Commands such as /gamemode and /give will not work from Bedrock with this enabled
xbox-achievements-enabled: false
# bStats is a stat tracker that is entirely anonymous and tracks only basic information # bStats is a stat tracker that is entirely anonymous and tracks only basic information
# about Geyser, such as how many people are online, how many servers are using Geyser, # about Geyser, such as how many people are online, how many servers are using Geyser,
# what OS is being used, etc. You can learn more about bStats here: https://bstats.org/. # what OS is being used, etc. You can learn more about bStats here: https://bstats.org/.