mirror of
https://github.com/jie65535/mirai-console-jms-plugin.git
synced 2025-12-15 19:07:33 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c143bb4d4 | |||
|
|
9b281361ce | ||
| 1902e922a3 | |||
| 5113868a79 | |||
| d45d1caf56 |
@@ -1,15 +1,22 @@
|
||||
plugins {
|
||||
val kotlinVersion = "1.5.30"
|
||||
val kotlinVersion = "1.7.10"
|
||||
kotlin("jvm") version kotlinVersion
|
||||
kotlin("plugin.serialization") version kotlinVersion
|
||||
|
||||
id("net.mamoe.mirai-console") version "2.9.2"
|
||||
id("net.mamoe.mirai-console") version "2.13.2"
|
||||
}
|
||||
|
||||
group = "top.jie65535"
|
||||
version = "0.1.0"
|
||||
version = "0.1.2"
|
||||
|
||||
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")
|
||||
}
|
||||
@@ -76,8 +76,17 @@ object JMSCommand : CompositeCommand(
|
||||
}
|
||||
|
||||
private suspend fun CommandSender.sendImage(data: ByteArray) {
|
||||
try {
|
||||
if (data.isEmpty()) {
|
||||
subject?.sendMessage("未查询到数据")
|
||||
return
|
||||
}
|
||||
|
||||
data.toExternalResource().use {
|
||||
subject?.sendImage(it)
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
subject?.sendMessage(String(data))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ object JMinecraftSkin : KotlinPlugin(
|
||||
JvmPluginDescription(
|
||||
id = "top.jie65535.mirai-console-jms-plugin",
|
||||
name = "J Minecraft Skin",
|
||||
version = "0.1.0",
|
||||
version = "0.1.2",
|
||||
) {
|
||||
author("jie65535")
|
||||
info("MC皮肤查询插件")
|
||||
@@ -19,7 +19,7 @@ object JMinecraftSkin : KotlinPlugin(
|
||||
override fun onEnable() {
|
||||
JMSPluginData.reload()
|
||||
JMSCommand.register()
|
||||
logger.info { "Plugin loaded" }
|
||||
logger.info { "Plugin loaded. https://github.com/jie65535/mirai-console-jcf-plugin" }
|
||||
}
|
||||
|
||||
override fun onDisable() {
|
||||
|
||||
@@ -11,25 +11,25 @@ object MinecraftSkinService {
|
||||
* 获取头像
|
||||
*/
|
||||
fun getAvatars(uuid: String)
|
||||
= HttpUtil.get("https://crafatar.com/avatars/$uuid")
|
||||
= HttpUtil.get("https://crafatar.com/avatars/$uuid?overlay")
|
||||
|
||||
/**
|
||||
* 获取玩家头模型渲染图
|
||||
*/
|
||||
fun getHeadRenders(uuid: String)
|
||||
= HttpUtil.get("https://crafatar.com/renders/head/$uuid")
|
||||
= HttpUtil.get("https://crafatar.com/renders/head/$uuid?overlay")
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤模型渲染图
|
||||
*/
|
||||
fun getBodyRenders(uuid: String)
|
||||
= HttpUtil.get("https://crafatar.com/renders/body/$uuid")
|
||||
= HttpUtil.get("https://crafatar.com/renders/body/$uuid?overlay")
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤源文件
|
||||
*/
|
||||
fun getSkins(uuid: String)
|
||||
= HttpUtil.get("https://crafatar.com/skin/$uuid")
|
||||
= HttpUtil.get("https://crafatar.com/skins/$uuid")
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤源文件
|
||||
|
||||
@@ -3,10 +3,8 @@ package top.jie65535
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.jsonPrimitive
|
||||
import net.mamoe.mirai.console.util.cast
|
||||
|
||||
/**
|
||||
* Minecraft UUID Service
|
||||
|
||||
Reference in New Issue
Block a user