feat: Optimizing Code

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2019-03-25 17:15:27 +08:00
parent 135d0f2b90
commit a875a6ca8e

View File

@ -14,6 +14,7 @@ var packageNameCache = [];
var description = { var description = {
name: 'MiaoScriptPackageManager', name: 'MiaoScriptPackageManager',
prefix: 'PM',
version: '1.0', version: '1.0',
author: 'MiaoWoo', author: 'MiaoWoo',
description: 'MiaoScript包管理工具', description: 'MiaoScript包管理工具',
@ -75,7 +76,7 @@ function enable() {
function main(sender, command, args) { function main(sender, command, args) {
if (!args[0] || args[1] === 'help') { if (!args[0] || args[1] === 'help') {
sendHelp(sender); console.sender(sender, help);
return; return;
} }
switch (args[0]) { switch (args[0]) {
@ -169,17 +170,11 @@ function main(sender, command, args) {
console.sender(sender, '§6插件 §a' + name + ' §6已生成到插件目录...'); console.sender(sender, '§6插件 §a' + name + ' §6已生成到插件目录...');
break; break;
default: default:
sendHelp(sender); console.sender(sender, help);
break; break;
} }
} }
function sendHelp(sender) {
help.forEach(function(msg) {
console.sender(sender, msg);
})
}
function del(sender, name) { function del(sender, name) {
if (pluginCache.indexOf(name) !== -1) { if (pluginCache.indexOf(name) !== -1) {
console.sender(sender, '§c插件 %s 不存在!'.format(name)); console.sender(sender, '§c插件 %s 不存在!'.format(name));