diff --git a/packages/docs/.gitignore b/packages/docs/.gitignore new file mode 100644 index 00000000..4cb12d8d --- /dev/null +++ b/packages/docs/.gitignore @@ -0,0 +1,16 @@ +# Node rules: +## Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +## Dependency directory +## Commenting this out is preferred by some people, see +## https://docs.npmjs.com/misc/faq#should-i-check-my-node_modules-folder-into-git +node_modules + +# Book build output +_book + +# eBook build output +*.epub +*.mobi +*.pdf diff --git a/packages/docs/1-user/1-index.md b/packages/docs/1-user/1-index.md new file mode 100644 index 00000000..e69de29b diff --git a/packages/docs/1-user/1.1-check-env.md b/packages/docs/1-user/1.1-check-env.md new file mode 100644 index 00000000..f81dac56 --- /dev/null +++ b/packages/docs/1-user/1.1-check-env.md @@ -0,0 +1,23 @@ +## 安装前的环境检查 + +Java 环境要求 +- Java8以上 且存在 `Nashorn` ScriptEngine + +> [!WARNING] +> 在非认证的服务端上运行本插件 可能导致不可预知的后果. + +服务端 版本要求 +- 纯净端 + - 1.7.10-1.15.2 + - Spigot + - Paper +- MOD端 + - 1.7.10 + - Uranium + - 1.12.2 + - Sponge + - CatServer +- 基岩端 + - Nukkit +- 跨服端 + - BungeeCord diff --git a/packages/docs/1-user/1.2-install-plugin.md b/packages/docs/1-user/1.2-install-plugin.md new file mode 100644 index 00000000..6486f52c --- /dev/null +++ b/packages/docs/1-user/1.2-install-plugin.md @@ -0,0 +1,96 @@ +## 下载 安装 插件 + +### 下载最新版本插件 + +- 插件商城: [下载地址](http://w.yumc.pw/free.html#MiaoScript-download) +- 构建站: [下载地址](https://ci.yumc.pw/job/Minecraft/job/MiaoScript/lastSuccessfulBuild/artifact/target/MiaoScript.jar) + +### 安装到对应服务端的插件目录 + +- Spigot => plugins +- Sponge => mods +- BungeeCord => plugins +- Nukkit => plugins + +### 重启服务器 + +- 启动后 `MiaoScript` 会在 `MiaoScript Thread` 线程初始化 +- 首次启动 插件需要下载完整的环境 可能需要一些时间 请耐心等待 +- 例如在 `Nukkit` 服务端首次启动 +``` +00:44:27 [INFO ] 开启 MiaoScript v0.2.0 中 +00:44:27 [INFO ] [MiaoScript] Loading custom BIOS file /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript/bios.js +00:44:27 [INFO ] [MiaoScript] Class loader compatible: cn.nukkit.plugin.PluginClassLoader +00:44:27 [INFO ] [MiaoScript] Parent class loader: sun.misc.Launcher$AppClassLoader +00:44:27 [INFO ] 启动 GS4 状态监听器 +00:44:27 [INFO ] 将 Query 端口设置为 19133 +00:44:27 [INFO ] Query 运行于 0.0.0.0:19133 +00:44:27 [INFO ] 启动完成 (2.094s)!如需帮助,请输入 "help" 或 "?" +00:44:27 [INFO ] [MiaoScript] Loading Engine at Thread MiaoScript Async Preloader Thread +00:44:27 [INFO ] [MiaoScript] Initialization require module. ParentDir: /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript +00:44:28 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/ployfill from taobao registry. try fetch from yumc registry... +00:44:28 [INFO ] [MiaoScript] fetch node_module @ms/ployfill from https://repo.yumc.pw/repository/npm/@ms/ployfill/-/ployfill-0.3.0.tgz waiting... +00:44:29 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/i18n from taobao registry. try fetch from yumc registry... +00:44:29 [INFO ] [MiaoScript] fetch node_module @ms/i18n from https://repo.yumc.pw/repository/npm/@ms/i18n/-/i18n-0.3.0.tgz waiting... +00:44:29 [INFO ] [MiaoScript] fetch node_module js-yaml from https://registry.npm.taobao.org/js-yaml/download/js-yaml-3.13.1.tgz waiting... +00:44:30 [INFO ] [MiaoScript] fetch node_module buffer from https://registry.npm.taobao.org/buffer/download/buffer-5.4.3.tgz waiting... +00:44:31 [INFO ] [MiaoScript] fetch node_module base64-js from https://registry.npm.taobao.org/base64-js/download/base64-js-1.3.1.tgz waiting... +00:44:31 [INFO ] [MiaoScript] fetch node_module ieee754 from https://registry.npm.taobao.org/ieee754/download/ieee754-1.1.13.tgz waiting... +00:44:31 [INFO ] [MiaoScript] fetch node_module esprima from https://registry.npm.taobao.org/esprima/download/esprima-4.0.1.tgz waiting... +00:44:32 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/common from taobao registry. try fetch from yumc registry... +00:44:32 [INFO ] [MiaoScript] fetch node_module @ms/common from https://repo.yumc.pw/repository/npm/@ms/common/-/common-0.3.0.tgz waiting...00:44:33 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/nashorn from taobao registry. try fetch from yumc registry... +00:44:33 [INFO ] [MiaoScript] fetch node_module @ms/nashorn from https://repo.yumc.pw/repository/npm/@ms/nashorn/-/nashorn-0.3.0.tgz waiting... +00:44:38 [INFO ] [MiaoScript] 初始化 Java Nashorn 补丁. 请稍候... +00:44:38 [INFO ] [MiaoScript] fetch node_module es5-ext from https://registry.npm.taobao.org/es5-ext/download/es5-ext-0.10.53.tgz waiting...00:44:39 [INFO ] [MiaoScript] fetch node_module core-js from https://registry.npm.taobao.org/core-js/download/core-js-3.6.4.tgz waiting... +00:44:43 [INFO ] [MiaoScript] fetch node_module blob-polyfill from https://registry.npm.taobao.org/blob-polyfill/download/blob-polyfill-4.0.20190430.tgz waiting... +00:44:43 [INFO ] [MiaoScript] Java Nashorn 补丁 加载完成... 耗时 (5.386s)! +00:44:43 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/core from taobao registry. try fetch from yumc registry... +00:44:43 [INFO ] [MiaoScript] fetch node_module @ms/core from https://repo.yumc.pw/repository/npm/@ms/core/-/core-0.3.0.tgz waiting... +00:44:44 [INFO ] [MiaoScript] 初始化 MiaoScript IOC 容器 @ms/container. 请稍候... +00:44:44 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/api from taobao registry. try fetch from yumc registry... +00:44:44 [INFO ] [MiaoScript] fetch node_module @ms/api from https://repo.yumc.pw/repository/npm/@ms/api/-/api-0.3.0.tgz waiting...00:44:45 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/container from taobao registry. try fetch from yumc registry... +00:44:45 [INFO ] [MiaoScript] fetch node_module @ms/container from https://repo.yumc.pw/repository/npm/@ms/container/-/container-0.3.0.tgz waiting... +00:44:45 [INFO ] [MiaoScript] fetch node_module reflect-metadata from https://registry.npm.taobao.org/reflect-metadata/download/reflect-metadata-0.1.13.tgz waiting... +00:44:46 [INFO ] [MiaoScript] fetch node_module inversify from https://registry.npm.taobao.org/inversify/download/inversify-5.0.1.tgz waiting... +00:44:46 [INFO ] [MiaoScript] fetch node_module inversify-binding-decorators from https://registry.npm.taobao.org/inversify-binding-decorators/download/inversify-binding-decorators-4.0.0.tgz waiting... +00:44:47 [INFO ] [MiaoScript] fetch node_module source-map-builder from https://registry.npm.taobao.org/source-map-builder/download/source-map-builder-0.0.7.tgz waiting... +00:44:47 [INFO ] [MiaoScript] MiaoScript IOC 容器 @ms/container 加载完成 耗时(3.778s) +00:44:47 [INFO ] [MiaoScript] 检测到兼容的服务器类型. 设置 ServerType 值 nukkit ... +00:44:47 [INFO ] [MiaoScript] 初始化 MiaoScript 扩展 @ms/core @ms/nukkit @ms/plugin. 请稍候... +00:44:48 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/nukkit from taobao registry. try fetch from yumc registry... +00:44:48 [INFO ] [MiaoScript] fetch node_module @ms/nukkit from https://repo.yumc.pw/repository/npm/@ms/nukkit/-/nukkit-0.3.0.tgz waiting... +00:44:48 [INFO ] [MiaoScript] [DEBUG] can't fetch package @ms/plugin from taobao registry. try fetch from yumc registry... +00:44:48 [INFO ] [MiaoScript] fetch node_module @ms/plugin from https://repo.yumc.pw/repository/npm/@ms/plugin/-/plugin-0.3.0.tgz waiting... +00:44:48 [INFO ] [MiaoScript] MiaoScript 扩展 @ms/core @ms/nukkit @ms/plugin 加载完成 耗时(0.964s) +00:44:48 [INFO ] [MiaoScript] 初始化 MiaoScript 插件系统: pw.yumc.MiaoScript.MiaoScriptNukkit@1860ea68 ... +00:44:49 [INFO ] [MiaoScript] 总计 135 个 nukkit 事件 映射完成... +00:44:49 [INFO ] [MiaoScript] MiaoScript 开始引导插件系统. 请稍候... +00:44:49 [INFO ] [MiaoScript] 在 /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript/plugins 文件夹中扫描插件... +00:44:49 [INFO ] [MiaoScript] 在 /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript/plugins/nukkit 文件夹中扫描插件... +00:44:49 [INFO ] [MiaoScript] MiaoScript 插件加载完毕 耗时(0.062s)! +00:44:49 [INFO ] [MiaoScript] MiaoScript 脚本引擎 加载完毕... 耗时(21.804s)! +``` +- 后续启动 系统会直接加载本地缓存 +``` +00:40:37 [INFO ] 读取 MiaoScript v0.2.0 中 +00:40:37 [INFO ] 开启 MiaoScript v0.2.0 中 +00:40:37 [INFO ] [MiaoScript] Loading custom BIOS file /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript/bios.js +00:40:37 [INFO ] [MiaoScript] Class loader compatible: cn.nukkit.plugin.PluginClassLoader +00:40:37 [INFO ] [MiaoScript] Parent class loader: sun.misc.Launcher$AppClassLoader +00:40:37 [INFO ] [MiaoScript] Loading Engine at Thread MiaoScript Async Preloader Thread +00:40:37 [INFO ] [MiaoScript] Initialization require module. ParentDir: /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript +00:40:38 [INFO ] [MiaoScript] 初始化 Java Nashorn 补丁. 请稍候... +00:40:40 [INFO ] [MiaoScript] Java Nashorn 补丁 加载完成... 耗时 (2.727s)! +00:40:40 [INFO ] [MiaoScript] 初始化 MiaoScript IOC 容器 @ms/container. 请稍候... +00:40:41 [INFO ] [MiaoScript] MiaoScript IOC 容器 @ms/container 加载完成 耗时(0.507s) +00:40:41 [INFO ] [MiaoScript] 检测到兼容的服务器类型. 设置 ServerType 值 nukkit ... +00:40:41 [INFO ] [MiaoScript] 初始化 MiaoScript 扩展 @ms/core @ms/nukkit @ms/plugin. 请稍候... +00:40:41 [INFO ] [MiaoScript] MiaoScript 扩展 @ms/core @ms/nukkit @ms/plugin 加载完成 耗时(0.269s) +00:40:41 [INFO ] [MiaoScript] 初始化 MiaoScript 插件系统: pw.yumc.MiaoScript.MiaoScriptNukkit@6c69c68d ... +00:40:42 [INFO ] [MiaoScript] 总计 135 个 nukkit 事件 映射完成... +00:40:42 [INFO ] [MiaoScript] MiaoScript 开始引导插件系统. 请稍候...00:40:42 [INFO ] [MiaoScript] 在 /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript/plugins 文件夹中扫描插件... +00:40:42 [INFO ] [MiaoScript] 在 /yumc/app/nfs/theia/MinecraftWorkSpace/test/plugins/MiaoScript/plugins/nukkit 文件夹中扫描插件... +00:40:42 [INFO ] [MiaoScript] MiaoScript 插件加载完毕 耗时(0.045s)! +00:40:42 [INFO ] [MiaoScript] MiaoScript 脚本引擎 加载完毕... 耗时(4.755s)! +``` +- 至此 插件基础环境安装完毕! diff --git a/packages/docs/2-develop/1-index.md b/packages/docs/2-develop/1-index.md new file mode 100644 index 00000000..f61137ed --- /dev/null +++ b/packages/docs/2-develop/1-index.md @@ -0,0 +1,8 @@ +## 开发者部分 + +本教程默认开发者已掌握下列技能 + +- `Git` 代码版本控制工具 +- `Java` 各种服务端开发语言 +- `TypeScript` 类型化 `JavaScript` +- 熟悉需要开发的服务端的对应的 API diff --git a/packages/docs/2-develop/1.1-check-env.md b/packages/docs/2-develop/1.1-check-env.md new file mode 100644 index 00000000..0371370a --- /dev/null +++ b/packages/docs/2-develop/1.1-check-env.md @@ -0,0 +1,26 @@ +## 前提条件 + +本教程默认开发者已掌握下列技能 + +- `Git` 代码版本控制工具 +- `Java` 各种服务端开发语言 +- `TypeScript` 类型化 `JavaScript` +- 熟悉需要开发的服务端的对应的 API + +## 开发 IDE + +- VSCode +- Coding WebIDE + +## 开发环境准备 + +- 安装 `NodeJS` 和 `Yarn` +- 拉取代码 + - `git clone https://github.com/circlecloud/ms.git` +- 进入目录 `ms` +- 安装依赖包 + - `yarn` +- 建立内部依赖链接 + - `yarn bs` +- 编译一次生成对应的类库 + - `yarn build` diff --git a/packages/docs/2-develop/1.2-project-structure.md b/packages/docs/2-develop/1.2-project-structure.md new file mode 100644 index 00000000..b165b080 --- /dev/null +++ b/packages/docs/2-develop/1.2-project-structure.md @@ -0,0 +1,36 @@ +### 项目结构 + +```txt +└─packages + ├─api 全平台兼容的接口 + ├─core 核心代码 用于引导加载 + ├─common 公共类库代码 例如 http reflect 模块 + ├─client NodeJS 的 Minecraft 客户端 用于调试插件 + ├─container IOC容器 用于注入具体实现 + ├─docs Gitbook 文档源代码 + ├─ployfill Nashorn 的一些自定义增强 + ├─nashorn Nashorn 的类型定义 + ├─bungee BungeeCord API内部实现 + ├─bukkit Bukkit API内部实现 + ├─sponge Sponge API内部实现 + ├─nukkit Nukkit API内部实现 + ├─plugin 插件管理器 + ├─websocket Netty的WebSocket注入 + ├─type Java的类型定义 + | ├─bungee BungeeCord 类型定义 + | ├─bukkit Bukkit 类型定义 + | ├─sponge Sponge 类型定义 + | └─nukkit Nukkit 类型定义 + └─plugins 这里当然是插件啦 + ├─bungee 只兼容 BungeeCord 的插件 + ├─bukkit 只兼容 Bukkit 的插件 + ├─sponge 只兼容 Sponge 的插件 + └─nukkit 只兼容 Nukkit 的插件 +``` + +代码仓库 + +- Github: https://github.com/circlecloud/ms +- Coding: https://502647092.coding.net/p/ms/d/ms/git +- YUMC: https://git.yumc.pw/circlecloud/ms + diff --git a/packages/docs/2-develop/1.3-example.md b/packages/docs/2-develop/1.3-example.md new file mode 100644 index 00000000..1520dc82 --- /dev/null +++ b/packages/docs/2-develop/1.3-example.md @@ -0,0 +1,129 @@ +## 基本插件框架 + +### HelloWorld 示例插件 + +先来一个 `HelloWorld.ts` 插件示范! + +```ts +/// + +import { server } from '@ms/api'; +import { inject } from '@ms/container'; +import { plugin, interfaces, cmd, listener, tab } from '@ms/plugin' + +@plugin({ name: 'HelloWorld', version: '1.0.0', author: 'MiaoWoo', source: __filename }) +export class HelloWorld extends interfaces.Plugin { + @inject(server.Server) + private Server: server.Server + @config() + private config = { + version: 1.0.0 + } + + load() { + this.logger.log('Plugin load from MiaoScript Plugin System...'); + } + enable() { + this.logger.log('Plugin enable from MiaoScript Plugin System...'); + } + disable() { + this.logger.log('Plugin disable from MiaoScript Plugin System...'); + } + + bukkitload() { + this.logger.log('Load When ServerType is Bukkit!') + } + bukkitenable() { + this.logger.log('Enable When ServerType is Bukkit!') + } + bukkitdisable() { + this.logger.log('Disable When ServerType is Bukkit!') + } + + spongeload() { + this.logger.log('Load When ServerType is Sponge!') + } + spongeenable() { + this.logger.log('Enable When ServerType is Sponge!') + } + spongedisable() { + this.logger.log('Disable When ServerType is Sponge!') + } + + bungeeload() { + this.logger.log('Load When ServerType is BungeeCord!') + } + bungeeenable() { + this.logger.log('Enable When ServerType is BungeeCord!') + } + bungeedisable() { + this.logger.log('Disable When ServerType is BungeeCord!') + } + + nukkitload() { + this.logger.log('Load When ServerType is Nukkit!') + } + nukkitenable() { + this.logger.log('Enable When ServerType is Nukkit!') + } + nukkitdisable() { + this.logger.log('Disable When ServerType is Nukkit!') + } + + @cmd() + hello(sender: any, command: string, args: string[]) { + this.logger.log(sender, command, args); + sender.sendMessage(JSON.stringify({ command, ...args })) + } + + @tab() + tabhello(_sender: any, _command: string, _args: string[]) { + return ['world'] + } + + // bukkit nukkit 大部分API神似 可以直接用 + @listener({ servers: ['bukkit', 'nukkit'] }) + PlayerJoin(event: org.bukkit.event.player.PlayerJoinEvent) { + let plyaer = event.getPlayer(); + this.logger.console(`§cBukkit §aPlayerJoinEvent: §b${plyaer.getName()}`) + setTimeout(() => this.sendWelcome(plyaer), 10); + } + + @listener({ servers: ['sponge'] }) + ClientConnectionEvent$Join(event: org.spongepowered.api.event.network.ClientConnectionEvent.Join) { + this.logger.console(`§cSponge §aClientConnectionEvent.Join: §b${event.getTargetEntity().getName()}`) + setTimeout(() => this.sendWelcome(event.getTargetEntity()), 10); + } + + private sendWelcome(player: any) { + this.logger.sender(player, `§a欢迎来到 §bMiaoScript §a的世界!`) + this.logger.sender(player, `§6当前版本: §c${this.Server.getVersion()}`) + } + + @listener({ servers: ['bungee'] }) + ServerConnected(e: any) { + let event = e as net.md_5.bungee.api.event.ServerConnectedEvent + this.logger.console(`§cBungeeCord §aServerConnectedEvent: §b${event.getPlayer().getDisplayName()}`) + setTimeout(() => this.logger.sender(event.getPlayer(), `§a欢迎来到 §bMiaoScript §a的世界 §6来自 §cBungeeCord §6的问候!`), 10); + } +} +``` + +- 进入 `ms` 目录 +- 执行编译 `yarn build:plugins` +- 从 `packages/plugins/dist` 中复制 `HelloWorld.js` 和 `HelloWorld.js.map`(可选 用于显示插件原有行数) 文件 到对应的插件目录 + - Bungee: plugins/MiaoScript/plugins/ + - Bukkit: plugins/MiaoScript/plugins/ + - Sponge: config/miaoscript/plugins/ + - Nukkit: plugins/MiaoScript/plugins/ +- 重载 `MiaoScript` +- 打开客户端进入游戏 预览一下效果 +- 从 Spigot 服务端进入 +![image.png](https://i.loli.net/2019/09/22/2BZuwF65WV1xGnv.png) +![image.png](https://i.loli.net/2019/09/22/m2CftwbalnXsxvg.png) +- 从 Sponge 服务端进入 +![image.png](https://i.loli.net/2019/09/22/QD1jrShtJpPXyVl.png) +![image.png](https://i.loli.net/2019/09/22/GzLFVC3sjAJ4obm.png) +- 从 Nukkit 服务端进入 +![image.png](https://i.loli.net/2020/03/03/Xvr7SZJ5YdICgko.png) +![image.png](https://i.loli.net/2020/03/03/Q28AW9b7pIVL1j6.png) diff --git a/packages/docs/2-develop/2.1-plugin-lifecycle.md b/packages/docs/2-develop/2.1-plugin-lifecycle.md new file mode 100644 index 00000000..219ef823 --- /dev/null +++ b/packages/docs/2-develop/2.1-plugin-lifecycle.md @@ -0,0 +1,26 @@ +## 插件生命周期 + +MiaoScript 的生命周期遵循了 Bukkit 的生命周期 + +![MiaoScript 生命周期](https://www.plantuml.com/plantuml/svg/0/VL7BJi9G5DptA-uVi8TD5xhJbLzGe98cfP2sk3QcLH2aO7W542H2g0e5GuG4ql8pFRUtVs6X3I0-Dht9d9apCwUq93EYd4dow9nZKXSnaKlBoAbqeMn2MSVjBaLj6HGLnhbth6aepMSId20XifY0fKIeC5XlJd42zy_4DB7sQA_cH6dYzYYoaz2-1k6PJeOl6xoZm6hfay7es5P-ioVRnxKnabZnYXKb1DeDhauHAIx0geCM63XDnPSTR8-bX4ik4MpVFA0ENFN1CGsShTdh9nWtt5M367qVt2g7f5T0PoacZjp671kVUn3dNk6Z-cCMM2NZ8LfceeTcjmNlMFQg7oAz0QZw0Pld99aLMF4xsrxclVnEgmobqTxsL62YFFjNckCfMRUyacHTyZX78AWpjpxUWNv_v5U7x3GuJEqkkE5CTolNAFWLsnvxzFUa9vpqNzJZCSKASOgYlMyc-GK0 "MiaoScript 生命周期") + +### load 加载阶段 + +此阶段通常用于初始化基础配置 数据库链接等 +某些对外提供功能的插件 需要在此阶段初始化完成 + +### enable 启动阶段 + +此阶段通常用于注册命令 注册事件等 +由于命令和事件 MiaoScript 已经托管了 所以开发者可以直接用注解实现 + +### disable 关闭阶段 + +此阶段通常用于注销命令 注销事件等 +由于命令和事件 MiaoScript 已经托管了 所以开发者可以直接用注解实现 + +### 扩展的生命周期 + +MiaoScript 针对不同的服务端 提供了扩展的周期 +以服务端类型开头阶段名结束 例如 `bukkitload` `spongeenbale` `bungeedisable` +扩展的生命周期只会在特定的服务器执行 diff --git a/packages/docs/2-develop/2.2-plugin-decorators.md b/packages/docs/2-develop/2.2-plugin-decorators.md new file mode 100644 index 00000000..d6116f43 --- /dev/null +++ b/packages/docs/2-develop/2.2-plugin-decorators.md @@ -0,0 +1,3 @@ +## @plugin 注解 + +TODO \ No newline at end of file diff --git a/packages/docs/2-develop/2.3-cmd-tab-decorators.md b/packages/docs/2-develop/2.3-cmd-tab-decorators.md new file mode 100644 index 00000000..8cfd2076 --- /dev/null +++ b/packages/docs/2-develop/2.3-cmd-tab-decorators.md @@ -0,0 +1,3 @@ +## @cmd/@tab 注解 + +TODO \ No newline at end of file diff --git a/packages/docs/2-develop/2.4-listener-decorators.md b/packages/docs/2-develop/2.4-listener-decorators.md new file mode 100644 index 00000000..c518fd73 --- /dev/null +++ b/packages/docs/2-develop/2.4-listener-decorators.md @@ -0,0 +1,3 @@ +## @listener 注解 + +TODO \ No newline at end of file diff --git a/packages/docs/2-develop/2.5-config-decorators.md b/packages/docs/2-develop/2.5-config-decorators.md new file mode 100644 index 00000000..c6c170df --- /dev/null +++ b/packages/docs/2-develop/2.5-config-decorators.md @@ -0,0 +1,3 @@ +## @config 注解 + +TODO \ No newline at end of file diff --git a/packages/docs/2-develop/lifecycle.plantuml b/packages/docs/2-develop/lifecycle.plantuml new file mode 100644 index 00000000..4aded1d6 --- /dev/null +++ b/packages/docs/2-develop/lifecycle.plantuml @@ -0,0 +1,27 @@ +@startuml MiaoScript 生命周期 + +start + +:扫描 plugins 路径; +:循环加载插件脚本; +:扫描 @plugin 注解; +:构建插件实例; +:判断 servers 参数 获得可加载的插件; +:扫描 @config 注解 注入配置或保存默认配置; +:执行 Load 阶段; +:执行 扩展 Load 阶段; +:扫描 @cmd/@tab 注解 注册命令/补全; +:扫描 @listener 注解 注册事件监听; +:执行 Enable 阶段; +:执行 扩展 Enable 阶段; +:进入运行阶段; +:进入关闭阶段; +:保存 配置到配置文件; +:注销 插件命令; +:注销 事件监听; +:执行 Disable 阶段; +:执行 扩展 Disable 阶段; + +end + +@endum \ No newline at end of file diff --git a/packages/docs/CHANGELOG.md b/packages/docs/CHANGELOG.md new file mode 100644 index 00000000..7b905864 --- /dev/null +++ b/packages/docs/CHANGELOG.md @@ -0,0 +1,49 @@ +- 2020-03-03 + - 发布 `v0.3.1` 版本 +- 2020-03-02 + - 杂项 更新文档以及示例插件 +- 2020-03-01 + - 修复 多个包之间的循环依赖问题 + - 优化 `@ms/types` 的引用逻辑 +- 2020-02-29 + - 更新 `TypeScript` 版本为 `3.8.3` + - 新增 `@ms/common` 的 `http` 下载功能 +- 2020-02-27 + - 发布 `v0.3.0` 版本 + - 新增 `@ms/i18n` 国际化包的支持 + - 修复 `@ms/plugin` 对 `servers` 相关处理异常 + - 优化 `@ms/api` 的 `Channel` 处理增加 扩展原始数据 +- 2020-02-26 + - 优化 `@ms/container` 使用 `autoProvide` 自动注入依赖 +- 2020-02-25 + - 修复 `@ms/api` 对 `evnet` 的类型处理异常 +- 2020-02-24 + - 发布 `v0.2.1` 版本 + - 完善 对 `Nukkit` 端的支持 + - 新增 `@ms/api` 通道相关的支持 +- 2020-02-23 + - 新增 `@ms/nukkit` 包 对 `Nukkit` 端的支持 + - 新增 `@ms/type` 的 `nukkit` 类型自动补全 +- 2020-02-22 + - 发布 `v0.2.0` 版本 + - 新增 `@ms/plugin` 的 `@config` 注解 目前支持 `json` `yml` 格式的配置 +- 2020-02-15 + - 新增 `SourceMap` 的支持 用于跟踪源代码行数 +- 2020-02-09 + - 新增 `core-js` 用于支持大部分新ES语法 +- 2020-01-31 + - 优化 `@ms/ployfill` 全局处理 +- 2020-01-15 + - 新增 `@ms/bungee` 包 对 `BungeeCord` 端的支持 +- 2020-01-14 + - 新增 `@ms/type` 的 `bungee` 类型自动补全 +- 2019-11-10 + - 新增 `WebSocket` 的注入支持 +- 2019-11-07 + - 新增 `@ms/type` 的 `jdk` 类型自动补全 +- 2019-09-27 + - 新增 `CatServer` MOD端的支持 +- 2019-09-25 + - 新增 `@ms/type` 的 `sponge` 类型自动补全 +- 2019-09-24 + - 新增 `@ms/type` 的 `bukkit` 类型自动补全 diff --git a/packages/docs/README.md b/packages/docs/README.md new file mode 100644 index 00000000..eb58c6a2 --- /dev/null +++ b/packages/docs/README.md @@ -0,0 +1,5 @@ +## 插件简介 + +- 此插件可以实现跨端使用 `TypeScript` 开发 脚本插件 +- 目前已经兼容 `Spigot` `Sponge` `Paper` `CatServer` `BungeeCord` `Nukkit` +- 后续计划兼容 暂无 diff --git a/packages/docs/SUMMARY.md b/packages/docs/SUMMARY.md new file mode 100644 index 00000000..83172889 --- /dev/null +++ b/packages/docs/SUMMARY.md @@ -0,0 +1,26 @@ +# 目录 + +* MiaoScript 插件文档 + +--- + +* [插件简介](README.md) +* [更新日志](CHANGELOG.md) + +--- + +* 1 用户 + * [1.1.1 安装前的环境检查](1-user/1.1-check-env.md) + * [1.1.2 安装插件](1-user/1.2-install-plugin.md) + +* 2 开发者 + * 2.1 基础 + * [2.1.1 开发前的环境准备](2-develop/1.1-check-env.md) + * [2.1.2 项目结构](2-develop/1.2-project-structure.md) + * [2.1.3 示例插件](2-develop/1.3-example.md) + * 2.2 入门 + * [2.2.1 插件的生命周期](2-develop/2.1-plugin-lifecycle.md) + * [2.2.2 @plugin 注解](2-develop/2.2-plugin-decorators.md) + * [2.2.3 @cmd/@tab 注解](2-develop/2.3-cmd-tab-decorators.md) + * [2.2.4 @listener 注解](2-develop/2.4-listener-decorators.md) + * [2.2.5 @config 注解](2-develop/2.5-config-decorators.md) diff --git a/packages/docs/book.json b/packages/docs/book.json new file mode 100644 index 00000000..e5665dd0 --- /dev/null +++ b/packages/docs/book.json @@ -0,0 +1,28 @@ +{ + "title" : "MiaoScipt 插件文档", + "author" : "MiaoWoo", + "plugins": [ + "code", + "todo", + "splitter", + "flexible-alerts", + "pageview-count", + "back-to-top-button" + ], + "pluginsConfig": { + "flexible-alerts": { + "note": { + "label": "注意" + }, + "tip": { + "label": "提示" + }, + "warning": { + "label": "警告" + }, + "danger": { + "label": "危险" + } + } + } +} diff --git a/packages/docs/package.json b/packages/docs/package.json new file mode 100644 index 00000000..b8f194f6 --- /dev/null +++ b/packages/docs/package.json @@ -0,0 +1,26 @@ +{ + "name": "ms-docs", + "version": "0.3.1", + "description": "MiaoScript docs package", + "keywords": [ + "miaoscript", + "minecraft", + "bukkit", + "sponge" + ], + "author": "MiaoWoo ", + "homepage": "https://github.com/circlecloud/ms.git", + "license": "ISC", + "publishConfig": { + "registry": "https://repo.yumc.pw/repository/npm-hosted/" + }, + "scripts": { + "dev": "gitbook serve", + "gi": "gitbook install", + "build": "gitbook build" + }, + "devDependencies": { + "gitbook-cli": "^2.3.2" + }, + "dependencies": {} +}