feat: 完善命令部分 添加事件自动注销

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
2017-10-11 14:20:06 +08:00
parent 6004590323
commit afdc39b1de
5 changed files with 73 additions and 59 deletions

View File

@ -19,7 +19,7 @@ function load() {
function enable() {
console.log('启用 Hello Wrold 测试插件!');
join = event.on('playerloginevent', function join(event) {
join = event.on(this, 'playerloginevent', function join(event) {
// noinspection JSUnresolvedVariable
log.d('玩家 %s 触发事件 %s', event.player.name, event.name);
setTimeout(function () {
@ -27,9 +27,9 @@ function enable() {
event.player.sendMessage(require("plugins/ext/papi").$(event.player, "§a欢迎来到 §bMiaoScript §a的世界! 当前在线: %server_online%"));
}, 10);
});
cmd.on(module.exports, 'hello', {
cmd.on(this, 'hello', {
cmd: function (sender, command, args) {
console.log(command, args);
console.log(command, args.join(' '));
return true;
},
tab: function (sender, command, args) {
@ -39,8 +39,9 @@ function enable() {
}
function disable() {
log.i('卸载 Hello Wrold 测试插件!');
event.off(join);
console.log('卸载 Hello Wrold 测试插件!');
// 可以不用关闭事件 程序将自动处理
// event.off(join);
}
module.exports = {