mirror of
https://github.com/jie65535/mirai-console-jms-plugin.git
synced 2025-06-02 17:39:17 +08:00
Update version to v1.0.0
Update dependencies Fix null UUID error
This commit is contained in:
parent
8c143bb4d4
commit
feb2d309e0
@ -1,22 +1,21 @@
|
||||
plugins {
|
||||
val kotlinVersion = "1.7.10"
|
||||
val kotlinVersion = "1.8.10"
|
||||
kotlin("jvm") version kotlinVersion
|
||||
kotlin("plugin.serialization") version kotlinVersion
|
||||
|
||||
id("net.mamoe.mirai-console") version "2.13.2"
|
||||
id("net.mamoe.mirai-console") version "2.15.0"
|
||||
}
|
||||
|
||||
group = "top.jie65535"
|
||||
version = "0.1.2"
|
||||
group = "top.jie65535.mirai"
|
||||
version = "1.0.0"
|
||||
|
||||
repositories {
|
||||
maven("https://maven.aliyun.com/repository/public")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
val ktorVersion = "2.2.2"
|
||||
|
||||
dependencies {
|
||||
implementation("io.ktor:ktor-client-core-jvm:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
|
||||
|
||||
implementation("io.ktor:ktor-client-core-jvm:2.3.2")
|
||||
implementation("io.ktor:ktor-client-okhttp-jvm:2.3.2")
|
||||
}
|
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
@ -9,7 +9,7 @@ object JMinecraftSkin : KotlinPlugin(
|
||||
JvmPluginDescription(
|
||||
id = "top.jie65535.mirai-console-jms-plugin",
|
||||
name = "J Minecraft Skin",
|
||||
version = "0.1.2",
|
||||
version = "1.0.0",
|
||||
) {
|
||||
author("jie65535")
|
||||
info("MC皮肤查询插件")
|
||||
|
@ -1,8 +1,8 @@
|
||||
package top.jie65535
|
||||
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonNull
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.jsonPrimitive
|
||||
|
||||
@ -16,7 +16,6 @@ object MinecraftUuidService {
|
||||
/**
|
||||
* 根据游戏角色名获取UUID
|
||||
*/
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
fun getUuid(username: String) : String {
|
||||
var uuid = JMSPluginData.idMap[username]
|
||||
if (uuid != null) {
|
||||
@ -26,10 +25,13 @@ object MinecraftUuidService {
|
||||
val retJson = HttpUtil.get("https://tenapi.cn/mc/?uid=$username").decodeToString()
|
||||
val response = Json.decodeFromString<JsonObject>(retJson)
|
||||
if (response["code"]!!.jsonPrimitive.content == "200") {
|
||||
uuid = response["id"]!!.jsonPrimitive.content
|
||||
val elem = response["id"]!!.jsonPrimitive
|
||||
if (elem == JsonNull) throw Exception("Player UUID Not Found!")
|
||||
uuid = elem.content
|
||||
} else {
|
||||
throw Exception(response["msg"]!!.jsonPrimitive.content)
|
||||
}
|
||||
|
||||
JMSPluginData.idMap[username] = uuid
|
||||
return uuid
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user