@@ -28,10 +28,10 @@ import com.lambda.event.events.ConnectionEvent.Connect.Login.EncryptionResponse
2828import com.lambda.event.listener.UnsafeListener.Companion.listenOnceUnsafe
2929import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafe
3030import com.lambda.event.listener.UnsafeListener.Companion.listenUnsafeConcurrently
31- import com.lambda.network.api.v1.endpoints.login
32- import com.lambda.network.api.v1.models.Authentication
3331import com.lambda.module.Module
3432import com.lambda.module.tag.ModuleTag
33+ import com.lambda.network.api.v1.endpoints.login
34+ import com.lambda.network.api.v1.models.Authentication
3535import com.lambda.network.api.v1.models.Authentication.Data
3636import com.lambda.util.extension.isOffline
3737import net.minecraft.client.network.AllowedAddressResolver
@@ -45,6 +45,7 @@ import net.minecraft.text.Text
4545import java.math.BigInteger
4646import java.util.*
4747
48+
4849object Network : Module(
4950 name = " Network" ,
5051 description = " Lambda Authentication" ,
@@ -78,7 +79,7 @@ object Network : Module(
7879 }
7980
8081 listenOnceUnsafe<ConnectionEvent .Connect .Post > {
81- if (mc.gameProfile.isOffline) return @listenOnceUnsafe true
82+ if (mc.gameProfile.isOffline) return @listenOnceUnsafe true // ToDo: If the player have the properties but are invalid this doesn't work
8283
8384 // If we log in right as the client responds to the encryption request, we start
8485 // a race condition where the game server haven't acknowledged the packets
@@ -89,8 +90,7 @@ object Network : Module(
8990 return @listenOnceUnsafe false
9091 }
9192
92- auth = resp
93- deserialized = gson.fromJson(String (Base64 .getUrlDecoder().decode(accessToken.split(" ." )[1 ])), Data ::class .java)
93+ updateToken(resp)
9494
9595 true
9696 }
@@ -113,7 +113,10 @@ object Network : Module(
113113 connection.send(LoginHelloC2SPacket (mc.session.username, mc.session.uuidOrNull))
114114 }
115115
116- internal fun updateToken (auth : Authentication ? ) { this .auth = auth }
116+ internal fun updateToken (resp : Authentication ? ) {
117+ auth = resp
118+ deserialized = gson.fromJson(String (Base64 .getUrlDecoder().decode(accessToken.split(" ." )[1 ])), Data ::class .java)
119+ }
117120
118121 enum class ApiVersion (val value : String ) {
119122 // We can use @Deprecated("Not supported") to remove old API versions in the future
0 commit comments