diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java index e126637b..10239f04 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java @@ -39,10 +39,7 @@ import com.github.games647.craftapi.model.skin.SkinProperty; import com.github.games647.craftapi.resolver.MojangResolver; import com.github.games647.fastlogin.bukkit.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; -import org.bukkit.entity.Player; -import javax.crypto.Cipher; -import javax.crypto.SecretKey; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -56,11 +53,23 @@ import java.util.Arrays; import java.util.Optional; import java.util.UUID; +import javax.crypto.Cipher; +import javax.crypto.SecretKey; + +import org.bukkit.entity.Player; + import static com.comphenix.protocol.PacketType.Login.Client.START; import static com.comphenix.protocol.PacketType.Login.Server.DISCONNECT; public class VerifyResponseTask implements Runnable { + private static final String ENCRYPTION_CLASS_NAME = "MinecraftEncryption"; + private static final Class ENCRYPTION_CLASS; + + static { + ENCRYPTION_CLASS = MinecraftReflection.getMinecraftClass("util." + ENCRYPTION_CLASS_NAME, ENCRYPTION_CLASS_NAME); + } + private final FastLoginBukkit plugin; private final PacketEvent packetEvent; private final KeyPair serverKey; @@ -214,8 +223,7 @@ public class VerifyResponseTask implements Runnable { .getMethodByParameters("a", Cipher.class, Cipher.class); // Get the needed Cipher helper method (used to generate ciphers from login key) - Class encryptionClass = MinecraftReflection.getMinecraftClass("MinecraftEncryption"); - cipherMethod = FuzzyReflection.fromClass(encryptionClass) + cipherMethod = FuzzyReflection.fromClass(ENCRYPTION_CLASS) .getMethodByParameters("a", int.class, Key.class); } }