fix: UUID API

This commit is contained in:
sbbtd 2024-02-22 15:00:32 +08:00 committed by jie65535
parent adef471210
commit 0fcc1c0d54
3 changed files with 4 additions and 7 deletions

View File

@ -7,7 +7,7 @@ plugins {
}
group = "top.jie65535.mirai"
version = "1.1.0"
version = "1.1.1"
repositories {
maven("https://maven.aliyun.com/repository/public")

View File

@ -9,7 +9,7 @@ object JMinecraftSkin : KotlinPlugin(
JvmPluginDescription(
id = "top.jie65535.mirai-console-jms-plugin",
name = "J Minecraft Skin",
version = "1.1.0",
version = "1.1.1",
) {
author("jie65535")
info("MC皮肤查询插件")

View File

@ -1,10 +1,7 @@
package top.jie65535
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonNull
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.*
/**
* Minecraft UUID Service
@ -25,7 +22,7 @@ object MinecraftUuidService {
val retJson = HttpUtil.get("https://tenapi.cn/v2/mc/?uid=$username").decodeToString()
val response = Json.decodeFromString<JsonObject>(retJson)
if (response["code"]!!.jsonPrimitive.content == "200") {
val elem = response["id"]!!.jsonPrimitive
val elem = response["data"]!!.jsonObject["id"]!!.jsonPrimitive
if (elem == JsonNull) throw Exception("Player UUID Not Found!")
uuid = elem.content
} else {