From 78aa9afe3988ae05ddf4650e449f4e027501146d Mon Sep 17 00:00:00 2001 From: Shanwer Date: Sat, 27 Jul 2024 15:04:46 +0800 Subject: [PATCH] Readd old dependency to maintain authlib login support --- bootstrap/mod/fabric/build.gradle.kts | 3 ++- core/build.gradle.kts | 3 +++ .../java/org/geysermc/geyser/session/GeyserSession.java | 7 +++---- gradle/libs.versions.toml | 2 ++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bootstrap/mod/fabric/build.gradle.kts b/bootstrap/mod/fabric/build.gradle.kts index 0d083fcf789..dc197c69656 100644 --- a/bootstrap/mod/fabric/build.gradle.kts +++ b/bootstrap/mod/fabric/build.gradle.kts @@ -25,6 +25,7 @@ dependencies { shadow(libs.protocol.connection) { isTransitive = false } shadow(libs.protocol.common) { isTransitive = false } shadow(libs.protocol.codec) { isTransitive = false } + shadow(libs.mcauthlib) { isTransitive = false } shadow(libs.minecraftauth) { isTransitive = false } shadow(libs.raknet) { isTransitive = false } @@ -67,4 +68,4 @@ modrinth { dependencies { required.project("fabric-api") } -} \ No newline at end of file +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 3b5cc3df9b2..b0f952ee14e 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -25,10 +25,13 @@ dependencies { api(libs.bundles.protocol) + api(libs.mcauthlib) api(libs.minecraftauth) api(libs.mcprotocollib) { exclude("io.netty", "netty-all") exclude("net.raphimc", "MinecraftAuth") + exclude("com.github.GeyserMC", "packetlib") + exclude("com.github.GeyserMC", "mcauthlib") } implementation(libs.raknet) { diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index 273d982a208..a5c5c38e004 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -27,12 +27,11 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; -import com.github.steveice10.mc.auth.data.GameProfile; +//import com.github.steveice10.mc.auth.data.GameProfile; import com.github.steveice10.mc.auth.exception.request.InvalidCredentialsException; import com.github.steveice10.mc.auth.exception.request.RequestException; import com.github.steveice10.mc.auth.service.AuthenticationService; import com.github.steveice10.mc.auth.service.MojangAuthenticationService; -import com.github.steveice10.mc.auth.service.MsaAuthenticationService; import io.netty.channel.Channel; import io.netty.channel.EventLoop; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; @@ -778,13 +777,13 @@ public void authenticate(String username,String password){ authenticationService.setUsername(username); authenticationService.setPassword(password); authenticationService.login(); - GameProfile profile = authenticationService.getSelectedProfile(); + com.github.steveice10.mc.auth.data.GameProfile profile = authenticationService.getSelectedProfile(); if (profile == null) { // Java account is offline disconnect(GeyserLocale.getPlayerLocaleString("geyser.network.remote.invalid_account", clientData.getLanguageCode())); return null; } - protocol = new MinecraftProtocol(profile, authenticationService.getAccessToken()); + protocol = new MinecraftProtocol(new GameProfile(profile.getId(), profile.getName()), authenticationService.getAccessToken()); } }catch (InvalidCredentialsException | IllegalArgumentException e) { geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.auth.login.invalid", username)); diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 58b5310ac15..494e61b0540 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,6 +12,7 @@ gson = "2.3.1" # Provided by Spigot 1.8.8 websocket = "1.5.1" protocol = "3.0.0.Beta2-20240704.153116-14" raknet = "1.0.0.CR3-20240416.144209-1" +mcauthlib = "e5b0bcc" minecraftauth = "4.1.0" mcprotocollib = "1.21-20240725.013034-16" adventure = "4.14.0" @@ -107,6 +108,7 @@ commodore = { group = "me.lucko", name = "commodore", version.ref = "commodore" guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" } +mcauthlib = { group = "com.github.GeyserMC", name = "MCAuthLib", version.ref = "mcauthlib" } minecraftauth = { group = "net.raphimc", name = "MinecraftAuth", version.ref = "minecraftauth" } mcprotocollib = { group = "org.geysermc.mcprotocollib", name = "protocol", version.ref = "mcprotocollib" } raknet = { group = "org.cloudburstmc.netty", name = "netty-transport-raknet", version.ref = "raknet" }