diff --git a/.github/workflows/publish-release-version.yml b/.github/workflows/publish-release-version.yml new file mode 100644 index 0000000..0f1833b --- /dev/null +++ b/.github/workflows/publish-release-version.yml @@ -0,0 +1,42 @@ +name: Publish release version + +on: + # 触发条件 + push: + tags: + - 'v*.*.*' + +jobs: + # 任务名称 + build: + name: Publish mirai plugin + # 运行环境 + runs-on: ubuntu-latest + # 步骤 + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + # 设置JDK 版本 + - name: Setup JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + # 获取标签的版本设置到 output + - name: Set output + id: vars + run: echo ::set-output name=version::$(echo ${GITHUB_REF:11}) + # 设置权限 + - name: Setup gradlew permission + run: chmod +x gradlew + # 编译插件 + - name: Build mirai plugin + run: ./gradlew buildPlugin + # 将文件上传到 GitHub release + - name: Upload jar to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/mirai/mirai-console-minecraft-plugin-${{ steps.vars.outputs.version }}.mirai.jar + tag: ${{ github.ref }} + diff --git a/.gitignore b/.gitignore index d877d09..ae6233e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,58 +1,19 @@ -# Mirai +# mirai bots/ config/ data/ plugins/ - - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -target/ -build/ - -.idea/ -*.iml -mirai.iml -/.idea/ -.idea/* -/.idea/* - -/test - -.gradle/ - local.properties -# Maven publishing credits -keys.properties -/plugins/ +# Gradle +.gradle +**/build/ +!src/**/build/ -token.txt -bintray.user.txt -bintray.key.txt +# Idea +.idea/*.xml +*.iml +!.idea/copyright/ -# For gpg sign -/build-gpg-sign -# Name for IDEA direction sorting -build-secret-keys/ \ No newline at end of file +# mac os +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/copyright/mirai-console-mcmod-plugin.xml b/.idea/copyright/mirai-console-mcmod-plugin.xml new file mode 100644 index 0000000..30bfad6 --- /dev/null +++ b/.idea/copyright/mirai-console-mcmod-plugin.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..8fe0a1e --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/README.md b/README.md index 773053f..8a36339 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ -# Mirai Console Minecraft Plugin - -Mirai Console Minecraft Plugin +
+[![](https://img.shields.io/github/v/release/limbang/mirai-console-minecraft-plugin?include_prereleases)](https://github.com/limbang/mirai-console-minecraft-plugin/releases) +![](https://img.shields.io/github/downloads/limbang/mirai-console-minecraft-plugin/total) +[![](https://img.shields.io/github/license/limbang/mirai-console-minecraft-plugin)](https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE) +[![](https://img.shields.io/badge/mirai-2.10.0-69c1b9)](https://github.com/mamoe/mirai) +本项目是基于 Mirai Console 编写的插件 +

用于 ping 服务器状态,和查看服务器 tps,基于doctor库实现

+

戳一戳机器人头像可以获取帮助

+
## 命令 @@ -14,6 +20,12 @@ Mirai Console Minecraft Plugin /mc deleteServer # 删除服务器 /mc loginInfo # 查看登陆信息 ``` +### 使用TPS功能 +1. 使用指令添加登陆信息,比如添加遗落之地的皮肤站演示如下 +```shell +/mc addLogin nano https://skin.blackyin.xyz/api/yggdrasil/authserver https://skin.blackyin.xyz/api/yggdrasil/sessionserver 账号 密码 +``` +2. 然后添加服务器的时候用,`addServerLogin`命令添加,loginName 就是刚才设置的 nano,就可以使用了 mc addLogin url参考 [yggdrasil](https://github.com/yushijinhun/authlib-injector/wiki/Yggdrasil-%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%8A%80%E6%9C%AF%E8%A7%84%E8%8C%83#%E4%BC%9A%E8%AF%9D%E9%83%A8%E5%88%86) @@ -38,3 +50,18 @@ name 可设置如下 TPS 暂时只支持 Forge 端 +---- + +## 功能展示 + +戳一戳功能: +![](img/Screenshot_20220319_195629.jpg) + +tps 功能: +![](img/1704DCA5-EC7F-4EF9-BF80-10DAC604836D.png) + +直 ping 地址功能: +![](img/ABCBBD85-E183-41FE-BA3A-9D88853F43B3.png) + +ping 全部添加的服务器功能: +![](img/B12FD04B-B159-4D4A-BE62-EA39510D9106.png) \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 3905f19..585ab94 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,13 @@ plugins { - val kotlinVersion = "1.5.30" + val kotlinVersion = "1.6.10" kotlin("jvm") version kotlinVersion kotlin("plugin.serialization") version kotlinVersion - id("net.mamoe.mirai-console") version "2.8.3" + id("net.mamoe.mirai-console") version "2.10.0" } group = "top.limbang" -version = "1.1.7" +version = "1.1.8" repositories { maven("https://maven.fanua.top:8015/repository/maven-public/") diff --git a/img/1704DCA5-EC7F-4EF9-BF80-10DAC604836D.png b/img/1704DCA5-EC7F-4EF9-BF80-10DAC604836D.png new file mode 100644 index 0000000..355cf1a Binary files /dev/null and b/img/1704DCA5-EC7F-4EF9-BF80-10DAC604836D.png differ diff --git a/img/ABCBBD85-E183-41FE-BA3A-9D88853F43B3.png b/img/ABCBBD85-E183-41FE-BA3A-9D88853F43B3.png new file mode 100644 index 0000000..7042033 Binary files /dev/null and b/img/ABCBBD85-E183-41FE-BA3A-9D88853F43B3.png differ diff --git a/img/B12FD04B-B159-4D4A-BE62-EA39510D9106.png b/img/B12FD04B-B159-4D4A-BE62-EA39510D9106.png new file mode 100644 index 0000000..9b1edbb Binary files /dev/null and b/img/B12FD04B-B159-4D4A-BE62-EA39510D9106.png differ diff --git a/img/Screenshot_20220319_195629.jpg b/img/Screenshot_20220319_195629.jpg new file mode 100644 index 0000000..e6ae7b0 Binary files /dev/null and b/img/Screenshot_20220319_195629.jpg differ diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginCompositeCommand.kt b/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginCompositeCommand.kt index bb2cd92..c2d9ee0 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginCompositeCommand.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginCompositeCommand.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft import net.mamoe.mirai.console.command.CommandSender diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginData.kt b/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginData.kt index 68fb390..6af3a5a 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginData.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/MinecraftPluginData.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft import kotlinx.serialization.Serializable diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/MiraiConsoleMinecraftPlugin.kt b/src/main/kotlin/top/limbang/mirai/minecraft/MiraiConsoleMinecraftPlugin.kt index bf22487..6f267bb 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/MiraiConsoleMinecraftPlugin.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/MiraiConsoleMinecraftPlugin.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft @@ -20,7 +29,7 @@ import top.limbang.mirai.minecraft.service.ServerService.pingServer object MiraiConsoleMinecraftPlugin : KotlinPlugin( JvmPluginDescription( id = "top.limbang.mirai-console-minecraft-plugin", - version = "1.1.7", + version = "1.1.8", ) { author("limbang") } diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/extension/ByteArrayStreamExtension.kt b/src/main/kotlin/top/limbang/mirai/minecraft/extension/ByteArrayStreamExtension.kt index af83bf5..8d2c273 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/extension/ByteArrayStreamExtension.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/extension/ByteArrayStreamExtension.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft.extension import java.io.ByteArrayInputStream diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/extension/ImageExtension.kt b/src/main/kotlin/top/limbang/mirai/minecraft/extension/ImageExtension.kt index e3f8b67..71fe6c4 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/extension/ImageExtension.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/extension/ImageExtension.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft.extension diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/service/ImageService.kt b/src/main/kotlin/top/limbang/mirai/minecraft/service/ImageService.kt index 4f8a5b9..cb800ca 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/service/ImageService.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/service/ImageService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft.service import top.limbang.mirai.minecraft.MiraiConsoleMinecraftPlugin diff --git a/src/main/kotlin/top/limbang/mirai/minecraft/service/ServerService.kt b/src/main/kotlin/top/limbang/mirai/minecraft/service/ServerService.kt index f2ba2c7..7d768dd 100644 --- a/src/main/kotlin/top/limbang/mirai/minecraft/service/ServerService.kt +++ b/src/main/kotlin/top/limbang/mirai/minecraft/service/ServerService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2020-2022 limbang and contributors. + * + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * + * https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE + */ + package top.limbang.mirai.minecraft.service import kotlinx.coroutines.GlobalScope diff --git a/src/main/resources/META-INF/services/net.mamoe.mirai.console.plugin.jvm.JvmPlugin b/src/main/resources/META-INF/services/net.mamoe.mirai.console.plugin.jvm.JvmPlugin index 43a17a1..4f88e04 100644 --- a/src/main/resources/META-INF/services/net.mamoe.mirai.console.plugin.jvm.JvmPlugin +++ b/src/main/resources/META-INF/services/net.mamoe.mirai.console.plugin.jvm.JvmPlugin @@ -1 +1,10 @@ +# +# Copyright 2020-2022 limbang and contributors. +# +# 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. +# Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. +# +# https://github.com/limbang/mirai-console-minecraft-plugin/blob/master/LICENSE +# + top.limbang.mirai.minecraft.MiraiConsoleMinecraftPlugin \ No newline at end of file