From b6124e47101c66791f0a5675caf25125b0d3270b Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 16 Apr 2023 21:20:34 +0200 Subject: [PATCH] Fixed authentication not working sometimes in <= 1.6.4 --- .../injection/mixin/base/MixinClientConnection.java | 2 +- .../injection/mixin/base/MixinClientLoginNetworkHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java index 12a46002..e5a9ec7c 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientConnection.java @@ -78,7 +78,7 @@ public abstract class MixinClientConnection extends SimpleChannelInboundHandler< @Inject(method = "setupEncryption", at = @At("HEAD"), cancellable = true) private void storeEncryptionCiphers(Cipher decryptionCipher, Cipher encryptionCipher, CallbackInfo ci) { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + if (ProtocolHack.getTargetVersion(channel).isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { ci.cancel(); this.viafabricplus_decryptionCipher = decryptionCipher; this.viafabricplus_encryptionCipher = encryptionCipher; diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java index 60992261..fe12a0ad 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/base/MixinClientLoginNetworkHandler.java @@ -39,7 +39,7 @@ public class MixinClientLoginNetworkHandler { @Inject(method = "joinServerSession", at = @At("HEAD"), cancellable = true) public void dontVerifySessionIfCracked(String serverId, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { + if (ProtocolHack.getTargetVersion(connection.channel).isOlderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { if (!connection.channel.attr(ProtocolHack.LOCAL_VIA_CONNECTION).get().get(ProtocolMetadataStorage.class).authenticate) { cir.setReturnValue(null); }