fix: 修复plugin为undefined的问题
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
c13ef6f393
commit
0cdf1cf106
@ -6,9 +6,12 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import lombok.val;
|
||||
import pw.yumc.YumCore.annotation.NotProguard;
|
||||
import pw.yumc.YumCore.bukkit.Log;
|
||||
import pw.yumc.YumCore.bukkit.P;
|
||||
import pw.yumc.YumCore.bukkit.compatible.C;
|
||||
import pw.yumc.YumCore.mc.MinecraftTools;
|
||||
|
||||
@ -20,6 +23,10 @@ import pw.yumc.YumCore.mc.MinecraftTools;
|
||||
*/
|
||||
@NotProguard
|
||||
public class Base {
|
||||
public Plugin getPlugin() {
|
||||
return P.instance;
|
||||
}
|
||||
|
||||
public Class getClass(String name) throws ClassNotFoundException {
|
||||
return Class.forName(name);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ var EventPriority = Java.type("org.bukkit.event.EventPriority");
|
||||
var EventExecutor = Java.type("org.bukkit.plugin.EventExecutor");
|
||||
var IllegalStateException = Java.type("java.lang.IllegalStateException");
|
||||
|
||||
var mapEvent = [];
|
||||
var plugin = base.plugin;
|
||||
|
||||
/**
|
||||
* 扫描包 org.bukkit.event 下的所有事件
|
||||
@ -109,7 +109,7 @@ function listen(event, exec, priority, ignoreCancel) {
|
||||
exec(event);
|
||||
}
|
||||
}),
|
||||
require('plugin').$,
|
||||
plugin,
|
||||
ignoreCancel);
|
||||
// noinspection JSUnresolvedVariable
|
||||
log.d('注册事件 %s 方法 %s', eventCls.simpleName, exec.name === '' ? '匿名方法' : exec.name);
|
||||
@ -132,9 +132,10 @@ function unlisten(listener) {
|
||||
log.d('注销事件 %s', eventCls.simpleName);
|
||||
}
|
||||
|
||||
var mapEvent = [];
|
||||
// 映射事件名称
|
||||
mapEventName();
|
||||
log.i('Bukkit 事件映射完毕 共计 %s 个事件!', mapEvent.length);
|
||||
// log.i('Bukkit 事件映射完毕 共计 %s 个事件!', mapEvent.length);
|
||||
|
||||
module.exports = {
|
||||
on: listen,
|
||||
|
@ -4,7 +4,7 @@
|
||||
* 任务计划
|
||||
* Created by 蒋天蓓 on 2017/2/9 0009.
|
||||
*/
|
||||
var plugin = require('modules/plugin').$;
|
||||
var plugin = base.plugin;
|
||||
var BukkitRunnable = Java.type("org.bukkit.scheduler.BukkitRunnable");
|
||||
/**
|
||||
* 创建任务对象
|
||||
|
Loading…
Reference in New Issue
Block a user