From b9899c44a09c96117bc572a24bbe4a7b73b988b0 Mon Sep 17 00:00:00 2001 From: Aizistral Date: Sat, 22 Aug 2026 15:05:01 +0200 Subject: [PATCH] Restore WrappedUserApiService override --- .../nochatrestrictions/core/NCRCore.java | 21 ++++++ .../core/WrappedUserApiService.java | 64 +++++++++++++++++++ .../mixins/MixinMinecraft.java | 18 +++++- .../mixins/MixinYggdrasilUserApiService.java | 16 +---- .../nochatrestrictions/core/NCRCore.java | 21 ++++++ .../core/WrappedUserApiService.java | 64 +++++++++++++++++++ .../mixins/MixinMinecraft.java | 18 +++++- .../mixins/MixinYggdrasilUserApiService.java | 16 +---- .../nochatrestrictions/core/NCRCore.java | 21 ++++++ .../core/WrappedUserApiService.java | 64 +++++++++++++++++++ .../mixins/MixinMinecraft.java | 18 +++++- .../mixins/MixinYggdrasilUserApiService.java | 16 +---- 12 files changed, 306 insertions(+), 51 deletions(-) create mode 100644 Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java create mode 100644 Forge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java create mode 100644 NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java index 40521d3..f860b9e 100644 --- a/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java @@ -1,8 +1,29 @@ package com.aizistral.nochatrestrictions.core; +import java.util.Map; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.UserApiService.UserFlag; +import com.mojang.authlib.minecraft.UserApiService.UserProperties; + public class NCRCore { public static final Logger LOGGER = LogManager.getLogger("NoChatRestrictions"); + public static final UserProperties FORCED_USER_PROPERTIES; + + static { + ImmutableSet.Builder flags = ImmutableSet.builder(); + + flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat + flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu + flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu + // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons + // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks + // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either + + FORCED_USER_PROPERTIES = new UserProperties(flags.build(), Map.of()); + } + } diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java new file mode 100644 index 0000000..36ce804 --- /dev/null +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java @@ -0,0 +1,64 @@ +package com.aizistral.nochatrestrictions.core; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.Executor; + +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.TelemetrySession; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.minecraft.report.AbuseReportLimits; +import com.mojang.authlib.yggdrasil.request.AbuseReportRequest; +import com.mojang.authlib.yggdrasil.response.KeyPairResponse; + +public class WrappedUserApiService implements UserApiService { + private final UserApiService service; + + public WrappedUserApiService(UserApiService service) { + this.service = service; + } + + @Override + public UserProperties fetchProperties() { + return NCRCore.FORCED_USER_PROPERTIES; + } + + @Override + public boolean isBlockedPlayer(UUID playerID) { + return this.service.isBlockedPlayer(playerID); + } + + @Override + public void refreshBlockList() { + this.service.refreshBlockList(); + } + + @Override + public TelemetrySession newTelemetrySession(Executor executor) { + return TelemetrySession.DISABLED; + } + + // Methods below primarily concern chat reporting. Not doing anything with them + // here as that's out of scope for this mod, it's more of a No Chat Reports thing + + @Override + public KeyPairResponse getKeyPair() { + return this.service.getKeyPair(); + } + + @Override + public void reportAbuse(AbuseReportRequest request) { + this.service.reportAbuse(request); + } + + @Override + public boolean canSendReports() { + return this.service.canSendReports(); + } + + @Override + public AbuseReportLimits getAbuseReportLimits() { + return this.service.getAbuseReportLimits(); + } + +} diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java index 5e9761a..eb2cebe 100644 --- a/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java @@ -5,14 +5,26 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import com.aizistral.nochatrestrictions.core.NCRCore; +import com.aizistral.nochatrestrictions.core.WrappedUserApiService; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + import net.minecraft.client.Minecraft; +import net.minecraft.client.main.GameConfig; @Mixin(Minecraft.class) public class MixinMinecraft { - // Removal of multiplayer/chat/telemetry restrictions is handled in - // MixinYggdrasilUserApiService, so that it keeps working after in-game - // account switchers (e.g. IAS) replace the UserApiService instance. + @Inject(method = { "m_193585_", "createUserApiService" }, at = @At("RETURN"), cancellable = true) + public void onCreateUserApi(YggdrasilAuthenticationService authService, GameConfig gameConfig, + CallbackInfoReturnable info) { + UserApiService returnedService = info.getReturnValue(); + assert returnedService != null; + info.setReturnValue(new WrappedUserApiService(returnedService)); + + NCRCore.LOGGER.info("Successfully supplanted UserApiService with a wrapped version."); + } @Inject(method = { "m_294837_", "isNameBanned" }, at = @At("HEAD"), cancellable = true) public void onCheckNameBan(CallbackInfoReturnable info) { diff --git a/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java b/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java index cd92941..0e99493 100644 --- a/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java +++ b/Fabric/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java @@ -17,7 +17,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; /** * Applies the chat/multiplayer restriction removal directly on the concrete - * service class instead of wrapping it once at {@code Minecraft.createUserApiService}. + * service class instead of just wrapping it once at {@code Minecraft#createUserApiService}. * * In-game account switchers (e.g. IAS) build a brand new {@link YggdrasilUserApiService} * and swap it onto the Minecraft instance without going through the original wrapping @@ -27,26 +27,14 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; */ @Mixin(value = YggdrasilUserApiService.class, remap = false) public class MixinYggdrasilUserApiService { - private static final UserProperties FORCED_PROPERTIES; static { - ImmutableSet.Builder flags = ImmutableSet.builder(); - - flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat - flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu - flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu - // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons - // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks - // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either - - FORCED_PROPERTIES = new UserProperties(flags.build(), Map.of()); - NCRCore.LOGGER.info("MixinYggdrasilUserApiService initialized succesfully."); } @Inject(method = "fetchProperties", at = @At("RETURN"), cancellable = true) private void onFetchProperties(CallbackInfoReturnable info) { - info.setReturnValue(FORCED_PROPERTIES); + info.setReturnValue(NCRCore.FORCED_USER_PROPERTIES); } @Inject(method = "newTelemetrySession", at = @At("HEAD"), cancellable = true) diff --git a/Forge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java b/Forge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java index 40521d3..f860b9e 100644 --- a/Forge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java +++ b/Forge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java @@ -1,8 +1,29 @@ package com.aizistral.nochatrestrictions.core; +import java.util.Map; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.UserApiService.UserFlag; +import com.mojang.authlib.minecraft.UserApiService.UserProperties; + public class NCRCore { public static final Logger LOGGER = LogManager.getLogger("NoChatRestrictions"); + public static final UserProperties FORCED_USER_PROPERTIES; + + static { + ImmutableSet.Builder flags = ImmutableSet.builder(); + + flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat + flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu + flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu + // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons + // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks + // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either + + FORCED_USER_PROPERTIES = new UserProperties(flags.build(), Map.of()); + } + } diff --git a/Forge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java b/Forge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java new file mode 100644 index 0000000..36ce804 --- /dev/null +++ b/Forge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java @@ -0,0 +1,64 @@ +package com.aizistral.nochatrestrictions.core; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.Executor; + +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.TelemetrySession; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.minecraft.report.AbuseReportLimits; +import com.mojang.authlib.yggdrasil.request.AbuseReportRequest; +import com.mojang.authlib.yggdrasil.response.KeyPairResponse; + +public class WrappedUserApiService implements UserApiService { + private final UserApiService service; + + public WrappedUserApiService(UserApiService service) { + this.service = service; + } + + @Override + public UserProperties fetchProperties() { + return NCRCore.FORCED_USER_PROPERTIES; + } + + @Override + public boolean isBlockedPlayer(UUID playerID) { + return this.service.isBlockedPlayer(playerID); + } + + @Override + public void refreshBlockList() { + this.service.refreshBlockList(); + } + + @Override + public TelemetrySession newTelemetrySession(Executor executor) { + return TelemetrySession.DISABLED; + } + + // Methods below primarily concern chat reporting. Not doing anything with them + // here as that's out of scope for this mod, it's more of a No Chat Reports thing + + @Override + public KeyPairResponse getKeyPair() { + return this.service.getKeyPair(); + } + + @Override + public void reportAbuse(AbuseReportRequest request) { + this.service.reportAbuse(request); + } + + @Override + public boolean canSendReports() { + return this.service.canSendReports(); + } + + @Override + public AbuseReportLimits getAbuseReportLimits() { + return this.service.getAbuseReportLimits(); + } + +} diff --git a/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java b/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java index ffc0934..e470410 100644 --- a/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java +++ b/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java @@ -5,14 +5,26 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import com.aizistral.nochatrestrictions.core.NCRCore; +import com.aizistral.nochatrestrictions.core.WrappedUserApiService; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + import net.minecraft.client.Minecraft; +import net.minecraft.client.main.GameConfig; @Mixin(value = Minecraft.class, remap = false) public class MixinMinecraft { - // Removal of multiplayer/chat/telemetry restrictions is handled in - // MixinYggdrasilUserApiService, so that it keeps working after in-game - // account switchers (e.g. IAS) replace the UserApiService instance. + @Inject(method = { "m_193585_", "createUserApiService" }, at = @At("RETURN"), cancellable = true) + public void onCreateUserApi(YggdrasilAuthenticationService authService, GameConfig gameConfig, + CallbackInfoReturnable info) { + UserApiService returnedService = info.getReturnValue(); + assert returnedService != null; + info.setReturnValue(new WrappedUserApiService(returnedService)); + + NCRCore.LOGGER.info("Successfully supplanted UserApiService with a wrapped version."); + } @Inject(method = { "m_294837_", "isNameBanned" }, at = @At("HEAD"), cancellable = true) public void onCheckNameBan(CallbackInfoReturnable info) { diff --git a/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java b/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java index cd92941..0e99493 100644 --- a/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java +++ b/Forge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java @@ -17,7 +17,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; /** * Applies the chat/multiplayer restriction removal directly on the concrete - * service class instead of wrapping it once at {@code Minecraft.createUserApiService}. + * service class instead of just wrapping it once at {@code Minecraft#createUserApiService}. * * In-game account switchers (e.g. IAS) build a brand new {@link YggdrasilUserApiService} * and swap it onto the Minecraft instance without going through the original wrapping @@ -27,26 +27,14 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; */ @Mixin(value = YggdrasilUserApiService.class, remap = false) public class MixinYggdrasilUserApiService { - private static final UserProperties FORCED_PROPERTIES; static { - ImmutableSet.Builder flags = ImmutableSet.builder(); - - flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat - flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu - flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu - // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons - // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks - // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either - - FORCED_PROPERTIES = new UserProperties(flags.build(), Map.of()); - NCRCore.LOGGER.info("MixinYggdrasilUserApiService initialized succesfully."); } @Inject(method = "fetchProperties", at = @At("RETURN"), cancellable = true) private void onFetchProperties(CallbackInfoReturnable info) { - info.setReturnValue(FORCED_PROPERTIES); + info.setReturnValue(NCRCore.FORCED_USER_PROPERTIES); } @Inject(method = "newTelemetrySession", at = @At("HEAD"), cancellable = true) diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java index 40521d3..f860b9e 100644 --- a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java +++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/NCRCore.java @@ -1,8 +1,29 @@ package com.aizistral.nochatrestrictions.core; +import java.util.Map; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.UserApiService.UserFlag; +import com.mojang.authlib.minecraft.UserApiService.UserProperties; + public class NCRCore { public static final Logger LOGGER = LogManager.getLogger("NoChatRestrictions"); + public static final UserProperties FORCED_USER_PROPERTIES; + + static { + ImmutableSet.Builder flags = ImmutableSet.builder(); + + flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat + flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu + flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu + // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons + // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks + // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either + + FORCED_USER_PROPERTIES = new UserProperties(flags.build(), Map.of()); + } + } diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java new file mode 100644 index 0000000..36ce804 --- /dev/null +++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/core/WrappedUserApiService.java @@ -0,0 +1,64 @@ +package com.aizistral.nochatrestrictions.core; + +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.Executor; + +import com.google.common.collect.ImmutableSet; +import com.mojang.authlib.minecraft.TelemetrySession; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.minecraft.report.AbuseReportLimits; +import com.mojang.authlib.yggdrasil.request.AbuseReportRequest; +import com.mojang.authlib.yggdrasil.response.KeyPairResponse; + +public class WrappedUserApiService implements UserApiService { + private final UserApiService service; + + public WrappedUserApiService(UserApiService service) { + this.service = service; + } + + @Override + public UserProperties fetchProperties() { + return NCRCore.FORCED_USER_PROPERTIES; + } + + @Override + public boolean isBlockedPlayer(UUID playerID) { + return this.service.isBlockedPlayer(playerID); + } + + @Override + public void refreshBlockList() { + this.service.refreshBlockList(); + } + + @Override + public TelemetrySession newTelemetrySession(Executor executor) { + return TelemetrySession.DISABLED; + } + + // Methods below primarily concern chat reporting. Not doing anything with them + // here as that's out of scope for this mod, it's more of a No Chat Reports thing + + @Override + public KeyPairResponse getKeyPair() { + return this.service.getKeyPair(); + } + + @Override + public void reportAbuse(AbuseReportRequest request) { + this.service.reportAbuse(request); + } + + @Override + public boolean canSendReports() { + return this.service.canSendReports(); + } + + @Override + public AbuseReportLimits getAbuseReportLimits() { + return this.service.getAbuseReportLimits(); + } + +} diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java index 5e9761a..eb2cebe 100644 --- a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java +++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinMinecraft.java @@ -5,14 +5,26 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import com.aizistral.nochatrestrictions.core.NCRCore; +import com.aizistral.nochatrestrictions.core.WrappedUserApiService; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + import net.minecraft.client.Minecraft; +import net.minecraft.client.main.GameConfig; @Mixin(Minecraft.class) public class MixinMinecraft { - // Removal of multiplayer/chat/telemetry restrictions is handled in - // MixinYggdrasilUserApiService, so that it keeps working after in-game - // account switchers (e.g. IAS) replace the UserApiService instance. + @Inject(method = { "m_193585_", "createUserApiService" }, at = @At("RETURN"), cancellable = true) + public void onCreateUserApi(YggdrasilAuthenticationService authService, GameConfig gameConfig, + CallbackInfoReturnable info) { + UserApiService returnedService = info.getReturnValue(); + assert returnedService != null; + info.setReturnValue(new WrappedUserApiService(returnedService)); + + NCRCore.LOGGER.info("Successfully supplanted UserApiService with a wrapped version."); + } @Inject(method = { "m_294837_", "isNameBanned" }, at = @At("HEAD"), cancellable = true) public void onCheckNameBan(CallbackInfoReturnable info) { diff --git a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java index cd92941..0e99493 100644 --- a/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java +++ b/NeoForge/src/main/java/com/aizistral/nochatrestrictions/mixins/MixinYggdrasilUserApiService.java @@ -17,7 +17,7 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; /** * Applies the chat/multiplayer restriction removal directly on the concrete - * service class instead of wrapping it once at {@code Minecraft.createUserApiService}. + * service class instead of just wrapping it once at {@code Minecraft#createUserApiService}. * * In-game account switchers (e.g. IAS) build a brand new {@link YggdrasilUserApiService} * and swap it onto the Minecraft instance without going through the original wrapping @@ -27,26 +27,14 @@ import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; */ @Mixin(value = YggdrasilUserApiService.class, remap = false) public class MixinYggdrasilUserApiService { - private static final UserProperties FORCED_PROPERTIES; static { - ImmutableSet.Builder flags = ImmutableSet.builder(); - - flags.add(UserFlag.CHAT_ALLOWED); // always let the player access chat - flags.add(UserFlag.SERVERS_ALLOWED); // always let the player open multiplayer menu - flags.add(UserFlag.REALMS_ALLOWED); // always let the player open Realms menu - // flags.add(UserFlag.TELEMETRY_ENABLED); // not adding this for obvious reasons - // flags.add(UserFlag.OPTIONAL_TELEMETRY_AVAILABLE); // thanks but no thanks - // flags.add(UserFlag.PROFANITY_FILTER_ENABLED) // not adding this one either - - FORCED_PROPERTIES = new UserProperties(flags.build(), Map.of()); - NCRCore.LOGGER.info("MixinYggdrasilUserApiService initialized succesfully."); } @Inject(method = "fetchProperties", at = @At("RETURN"), cancellable = true) private void onFetchProperties(CallbackInfoReturnable info) { - info.setReturnValue(FORCED_PROPERTIES); + info.setReturnValue(NCRCore.FORCED_USER_PROPERTIES); } @Inject(method = "newTelemetrySession", at = @At("HEAD"), cancellable = true)