From c551cce685f909f35af4214e5771ce280ee908c5 Mon Sep 17 00:00:00 2001 From: coding Date: Sat, 6 Jan 2018 12:56:47 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/api/event.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/api/event.js b/src/main/resources/api/event.js index ad9efe2..f6a5257 100644 --- a/src/main/resources/api/event.js +++ b/src/main/resources/api/event.js @@ -91,7 +91,7 @@ function EventHandlerDefault() { throw new Error("当前服务器不支持事件系统!"); } - this.execute = function execute(exec) { + this.execute = function execute(name, exec, eventCls) { return function execute() { try { exec(arguments[arguments.length - 1]); @@ -99,7 +99,7 @@ function EventHandlerDefault() { console.console('§6插件 §b%s §6处理 §d%s §6事件时发生异常 §4%s'.format(name, this.class2Name(eventCls), ex)); console.ex(ex); } - } + }.bind(this); } /** @@ -122,7 +122,7 @@ function EventHandlerDefault() { priority = priority || 'NORMAL'; ignoreCancel = ignoreCancel || false; // noinspection JSUnusedGlobalSymbols - var listener = this.register(eventCls, this.execute(exec), priority, ignoreCancel); + var listener = this.register(eventCls, this.execute(name, exec, eventCls), priority, ignoreCancel); var listenerMap = this.listenerMap; // 添加到缓存 用于关闭插件的时候关闭事件 if (!listenerMap[name]) listenerMap[name] = [];