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 {
|
plugins {
|
||||||
val kotlinVersion = "1.5.30"
|
val kotlinVersion = "1.7.10"
|
||||||
kotlin("jvm") version kotlinVersion
|
kotlin("jvm") version kotlinVersion
|
||||||
kotlin("plugin.serialization") 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"
|
group = "top.jie65535"
|
||||||
version = "0.1.0"
|
version = "0.1.2"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://maven.aliyun.com/repository/public")
|
maven("https://maven.aliyun.com/repository/public")
|
||||||
mavenCentral()
|
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) {
|
private suspend fun CommandSender.sendImage(data: ByteArray) {
|
||||||
data.toExternalResource().use {
|
try {
|
||||||
subject?.sendImage(it)
|
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(
|
JvmPluginDescription(
|
||||||
id = "top.jie65535.mirai-console-jms-plugin",
|
id = "top.jie65535.mirai-console-jms-plugin",
|
||||||
name = "J Minecraft Skin",
|
name = "J Minecraft Skin",
|
||||||
version = "0.1.0",
|
version = "0.1.2",
|
||||||
) {
|
) {
|
||||||
author("jie65535")
|
author("jie65535")
|
||||||
info("MC皮肤查询插件")
|
info("MC皮肤查询插件")
|
||||||
@@ -19,7 +19,7 @@ object JMinecraftSkin : KotlinPlugin(
|
|||||||
override fun onEnable() {
|
override fun onEnable() {
|
||||||
JMSPluginData.reload()
|
JMSPluginData.reload()
|
||||||
JMSCommand.register()
|
JMSCommand.register()
|
||||||
logger.info { "Plugin loaded" }
|
logger.info { "Plugin loaded. https://github.com/jie65535/mirai-console-jcf-plugin" }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDisable() {
|
override fun onDisable() {
|
||||||
|
|||||||
@@ -11,29 +11,29 @@ object MinecraftSkinService {
|
|||||||
* 获取头像
|
* 获取头像
|
||||||
*/
|
*/
|
||||||
fun getAvatars(uuid: String)
|
fun getAvatars(uuid: String)
|
||||||
= HttpUtil.get("https://crafatar.com/avatars/$uuid")
|
= HttpUtil.get("https://crafatar.com/avatars/$uuid?overlay")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取玩家头模型渲染图
|
* 获取玩家头模型渲染图
|
||||||
*/
|
*/
|
||||||
fun getHeadRenders(uuid: String)
|
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)
|
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)
|
fun getSkins(uuid: String)
|
||||||
= HttpUtil.get("https://crafatar.com/skin/$uuid")
|
= HttpUtil.get("https://crafatar.com/skins/$uuid")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取玩家皮肤源文件
|
* 获取玩家皮肤源文件
|
||||||
*/
|
*/
|
||||||
fun getCapes(uuid: String)
|
fun getCapes(uuid: String)
|
||||||
= HttpUtil.get("https://crafatar.com/capes/$uuid")
|
= HttpUtil.get("https://crafatar.com/capes/$uuid")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package top.jie65535
|
|||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonElement
|
|
||||||
import kotlinx.serialization.json.JsonObject
|
import kotlinx.serialization.json.JsonObject
|
||||||
import kotlinx.serialization.json.jsonPrimitive
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import net.mamoe.mirai.console.util.cast
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minecraft UUID Service
|
* Minecraft UUID Service
|
||||||
|
|||||||
Reference in New Issue
Block a user