Skip to content

Commit

Permalink
fix: stop PartyFinderStats command from silently failing (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
TakoTheDev authored Sep 29, 2024
1 parent 24d1c76 commit fc0beae
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,21 @@ object PartyFinderStats {

fun printStats(username: String, withKick: Boolean) {
Skytils.launch {
val uuid = try {
MojangUtil.getUUIDFromUsername(username)
try {
val uuid = MojangUtil.getUUIDFromUsername(username) ?: run {
UChat.chat("$failPrefix §cFailed to get UUID for username $username")
return@launch
}
val member = API.getSelectedSkyblockProfile(uuid)?.members?.get(uuid.nonDashedString()) ?: run {
UChat.chat("$failPrefix §cFailed to get profile information for $username ($uuid)")
return@launch
}

playerStats(username, uuid, member, withKick)
} catch (e: MojangUtil.MojangException) {
e.printStackTrace()
UChat.chat("$failPrefix §cFailed to get UUID, reason: ${e.message}")
return@launch
} ?: return@launch
API.getSelectedSkyblockProfile(uuid)?.members?.get(uuid.nonDashedString())?.let { member ->
playerStats(username, uuid, member, withKick)
}
}.invokeOnCompletion { error ->
if (error != null) {
Expand Down

0 comments on commit fc0beae

Please sign in to comment.