fix: 修复事件注册错误

merge/2/HEAD refs/tags/V1.2Alpha-0-gc551cce
coding 2018-01-06 12:56:47 +00:00
parent e0a293823c
commit c551cce685
1 changed files with 3 additions and 3 deletions

View File

@ -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] = [];