File tree Expand file tree Collapse file tree 2 files changed +10
-11
lines changed
common/src/main/kotlin/com/lambda/module/modules/client Expand file tree Collapse file tree 2 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -80,11 +80,12 @@ object Discord : Module(
8080 delay(1000 )
8181
8282 val auth = rpc.applicationManager.authenticate()
83- val (authResp, error) = linkDiscord(discordToken = auth.accessToken)
84- if (error != null ) return warn(" Failed to link the discord account to the minecraft auth" )
8583
86- updateToken(authResp!! )
87- discordAuth = auth
84+ linkDiscord(discordToken = auth.accessToken)
85+ .fold(
86+ success = { updateToken(it); discordAuth = auth },
87+ failure = { warn(" Failed to link the discord account to the minecraft auth" ) },
88+ )
8889 }
8990
9091 private fun stop () {
Original file line number Diff line number Diff line change @@ -73,13 +73,11 @@ object Network : Module(
7373 // If we log in right as the client responds to the encryption request, we start
7474 // a race condition where the game server haven't acknowledged the packets
7575 // and posted to the sessionserver api
76- val (resp, error) = login(mc.session.username, hash)
77- if (error != null ) {
78- LOG .debug(" Unable to authenticate: ${error.message} " )
79- return @listenUnsafe
80- }
81-
82- updateToken(resp!! )
76+ login(mc.session.username, hash)
77+ .fold(
78+ success = { updateToken(it) },
79+ failure = { LOG .warn(" Unable to authenticate: $it " ) },
80+ )
8381 }
8482 }
8583
You can’t perform that action at this time.
0 commit comments