feat: 完善Sponge事件注册 新增player封装类

This commit is contained in:
coding
2017-12-28 08:30:16 +00:00
parent fe615564ce
commit ea5fe60538
8 changed files with 275 additions and 70 deletions

View File

@ -12,7 +12,13 @@ var Task = Java.type("org.spongepowered.api.scheduler.Task");
* @param func 任务
*/
exports.create = function (func) {
return Task.builder().execute(new Comsumer(func));
return Task.builder().execute(new Comsumer(function () {
try {
func();
} catch (ex) {
console.ex('§4插件执行任务时发生错误', ex);
}
}));
};
/**
* 运行任务