fix: 修复事件注册错误
This commit is contained in:
parent
e0a293823c
commit
c551cce685
@ -91,7 +91,7 @@ function EventHandlerDefault() {
|
|||||||
throw new Error("当前服务器不支持事件系统!");
|
throw new Error("当前服务器不支持事件系统!");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.execute = function execute(exec) {
|
this.execute = function execute(name, exec, eventCls) {
|
||||||
return function execute() {
|
return function execute() {
|
||||||
try {
|
try {
|
||||||
exec(arguments[arguments.length - 1]);
|
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.console('§6插件 §b%s §6处理 §d%s §6事件时发生异常 §4%s'.format(name, this.class2Name(eventCls), ex));
|
||||||
console.ex(ex);
|
console.ex(ex);
|
||||||
}
|
}
|
||||||
}
|
}.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,7 +122,7 @@ function EventHandlerDefault() {
|
|||||||
priority = priority || 'NORMAL';
|
priority = priority || 'NORMAL';
|
||||||
ignoreCancel = ignoreCancel || false;
|
ignoreCancel = ignoreCancel || false;
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// 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;
|
var listenerMap = this.listenerMap;
|
||||||
// 添加到缓存 用于关闭插件的时候关闭事件
|
// 添加到缓存 用于关闭插件的时候关闭事件
|
||||||
if (!listenerMap[name]) listenerMap[name] = [];
|
if (!listenerMap[name]) listenerMap[name] = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user