From d67f2843b0adecd4825f8321898f42cbb8a62fc5 Mon Sep 17 00:00:00 2001 From: coding Date: Sun, 29 Jul 2018 13:05:51 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E4=BD=9C=E8=80=85=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/main/resources/plugins/HelloWorld.js | 1 + src/main/resources/plugins/ItemTag.js | 2 +- src/main/resources/plugins/MiaoAuth.js | 1 + src/main/resources/plugins/MiaoBoard.js | 2 +- src/main/resources/plugins/MiaoChat.js | 2 +- .../plugins/MiaoScriptPackageManager.js | 25 +++++++++++++------ 7 files changed, 23 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 52689d7..fb7cfba 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ - 诞生于 `2016年08月25日` 这是 Git 上的第一个提交 具体啥时候我也忘了 - 起初 `MiaoScript` 只是用于服务器其他插件的变量执行 并且依赖于PAPI(不知道是啥的自己百度) - 比如 [`MiaoMenu`](http://w.yumc.pw/zc/MiaoMenu.html) 的部分复杂脚本 - - 比如 [`MiaoChat`](http://mcbbs.tvt.im/thread-631240-1-1.html) 的聊天变量 + - 比如 [`MiaoChat`](http://mcbbs.net/thread-631240-1-1.html) 的聊天变量 - 突然有一天 圈内的大佬 `QSB` @qiu1995 过来找我 说能不能用脚本监听玩家的事件 - PS: 这货自从用过 `DeluxeMenu` 之后就喜欢上了用JS写菜单 - 当初感觉没啥问题 就出了第一个简易的 `MiaoScript` 版本 还是用 yml 做的配置文件 diff --git a/src/main/resources/plugins/HelloWorld.js b/src/main/resources/plugins/HelloWorld.js index d2e76ea..1a56d88 100644 --- a/src/main/resources/plugins/HelloWorld.js +++ b/src/main/resources/plugins/HelloWorld.js @@ -13,6 +13,7 @@ var fs = require('fs'); var description = { name: 'HelloWorld', version: '1.0', + author: 'MiaoWoo', commands: { 'hello': { description: 'HelloWorld主命令' diff --git a/src/main/resources/plugins/ItemTag.js b/src/main/resources/plugins/ItemTag.js index 8ceb136..aee879c 100644 --- a/src/main/resources/plugins/ItemTag.js +++ b/src/main/resources/plugins/ItemTag.js @@ -10,7 +10,7 @@ var Keys; var description = { name: 'ItemTag', version: '1.0', - author: '喵♂呜' + author: 'MiaoWoo' }; var itemConfig; diff --git a/src/main/resources/plugins/MiaoAuth.js b/src/main/resources/plugins/MiaoAuth.js index 187284b..503c9b8 100644 --- a/src/main/resources/plugins/MiaoAuth.js +++ b/src/main/resources/plugins/MiaoAuth.js @@ -13,6 +13,7 @@ var fs = require('fs'); var description = { name: 'MiaoAuth', version: '1.0', + author: 'MiaoWoo', commands: { 'l': { description: 'MiaoAuth登录命令' diff --git a/src/main/resources/plugins/MiaoBoard.js b/src/main/resources/plugins/MiaoBoard.js index 36a7e5d..241f816 100644 --- a/src/main/resources/plugins/MiaoBoard.js +++ b/src/main/resources/plugins/MiaoBoard.js @@ -17,7 +17,7 @@ var boards = []; var description = { name: 'MiaoBoard', version: '1.0', - author: '喵呜', + author: 'MiaoWoo', commands: { 'mboard': { description: '喵式记分板主命令' diff --git a/src/main/resources/plugins/MiaoChat.js b/src/main/resources/plugins/MiaoChat.js index 492e82b..1eea30c 100644 --- a/src/main/resources/plugins/MiaoChat.js +++ b/src/main/resources/plugins/MiaoChat.js @@ -16,7 +16,7 @@ var Player; var description = { name: 'MiaoChat', version: '1.0', - author: '喵呜', + author: 'MiaoWoo', commands: { 'mchat': { description: 'MiaoChat登录命令' diff --git a/src/main/resources/plugins/MiaoScriptPackageManager.js b/src/main/resources/plugins/MiaoScriptPackageManager.js index d82bb3b..2b36a3c 100644 --- a/src/main/resources/plugins/MiaoScriptPackageManager.js +++ b/src/main/resources/plugins/MiaoScriptPackageManager.js @@ -15,7 +15,7 @@ var packageNameCache = []; var description = { name: 'MiaoScriptPackageManager', version: '1.0', - author: '喵♂呜', + author: 'MiaoWoo', description: 'MiaoScript包管理工具', commands: { 'mpm': { @@ -31,7 +31,7 @@ var description = { var help = [ '§6========= §6[§a' + description.name + '§6] 帮助 §aBy §b喵♂呜 §6=========', '§6/mpm §ainstall §e<插件名称> §6- §3安装插件', - '§6/mpm §alist §6- §3列出仓库插件', + '§6/mpm §alist [install]§6- §3列出仓库插件[已安装的插件]', '§6/mpm §aupdate §e<插件名称> §6- §3更新插件(无插件名称则更新源)', '§6/mpm §aupgrade §e<插件名称> §6- §3及时更新插件(update需要重启生效)', '§6/mpm §areload §e<插件名称> §6- §3重载插件(无插件名称则重载自身)', @@ -80,10 +80,18 @@ function main(sender, command, args){ } switch (args[0]) { case "list": - console.sender(sender, '§6当前 §bMiaoScriptPackageCenter §6中存在下列插件:'); - for (var pkgName in packageCache) { - var pkg = packageCache[pkgName]; - console.sender(sender, '§6插件名称: §b%s §6版本: §a%s'.format(pkg.name, pkg.version)) + if (args[1]) { + console.sender(sender, '§6当前 §bMiaoScript §6已安装下列插件:'); + pluginCache.forEach(function listInfo(pluginName){ + var desc = manager.plugins[pluginName].description; + console.sender(sender, '§6插件名称: §b%s §6版本: §a%s §6作者: §3%s'.format(desc.name, desc.version || '1.0', desc.author || '未知')) + }) + } else { + console.sender(sender, '§6当前 §bMiaoScriptPackageCenter §6中存在下列插件:'); + for (var pkgName in packageCache) { + var pkg = packageCache[pkgName]; + console.sender(sender, '§6插件名称: §b%s §6版本: §a%s §6作者: §3%s'.format(pkg.name, pkg.version || '1.0', pkg.author || '未知')) + } } break; case "install": @@ -98,7 +106,7 @@ function main(sender, command, args){ update(sender, args[1]); } else { load(); - console.sender(sender, "§a仓库缓存刷新成功 共存在 §b" + pluginCache.length + " §a个插件!") + console.sender(sender, "§a仓库缓存刷新成功 共存在 §b" + Object.keys(packageCache).length + " §a个插件!") } break; case "upgrade": @@ -171,12 +179,13 @@ function del(sender, name) { } manager.disable(name); fs.delete(plugin.__FILE__); + console.sender(sender, '§c插件 §b%s §c删除成功!'.format(name)); } function download(sender, name) { var plugin = packageCache[name]; if (!plugin) { - console.sender(sender, '§c插件§b', name, '§c不存在'); + console.sender(sender, '§c插件 §b%s §c不存在!'.format(name)); return; } var pfile = fs.file(__dirname, name + '.js');