From 9fbf7047a1db4845e48965c9752ef4ce6ee1b451 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Thu, 31 Dec 2020 17:18:39 +0100 Subject: [PATCH] Fixed a NoSuchMethodError --- .../main/java/org/geysermc/floodgate/crypto/AesCipher.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java index 2627584f6..f602f4be0 100644 --- a/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java +++ b/common/src/main/java/org/geysermc/floodgate/crypto/AesCipher.java @@ -31,6 +31,7 @@ import lombok.RequiredArgsConstructor; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.spec.GCMParameterSpec; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.security.Key; import java.security.SecureRandom; @@ -99,13 +100,15 @@ public final class AesCipher implements FloodgateCipher { } ivLength = buffer.position() - mark - 1; // don't include the splitter itself - buffer.position(mark); // reset to the pre-while index + // don't remove this cast, it'll cause problems if you remove it + ((Buffer) buffer).position(mark); // reset to the pre-while index } byte[] iv = new byte[ivLength]; buffer.get(iv); - buffer.position(buffer.position() + 1); // skip splitter + // don't remove this cast, it'll cause problems if you remove it + ((Buffer) buffer).position(buffer.position() + 1); // skip splitter byte[] cipherText = new byte[buffer.remaining()]; buffer.get(cipherText);