@@ -135,7 +135,7 @@ function EventHandlerDefault() {
 | 
			
		||||
        var listenerMap = this.listenerMap;
 | 
			
		||||
        // 添加到缓存 用于关闭插件的时候关闭事件
 | 
			
		||||
        if (!listenerMap[name]) listenerMap[name] = [];
 | 
			
		||||
        var offExec = function () {
 | 
			
		||||
        var offExec = function() {
 | 
			
		||||
            this.unregister(eventCls, listener);
 | 
			
		||||
            console.debug('插件 %s 注销事件 %s'.format(name, this.class2Name(eventCls)));
 | 
			
		||||
        }.bind(this);
 | 
			
		||||
@@ -156,10 +156,10 @@ var EventHandler = Object.assign(new EventHandlerDefault(), requireInternal('eve
 | 
			
		||||
console.info('%s 事件映射完毕 共计 %s 个事件!'.format(DetectServerType, EventHandler.mapEventName().toFixed(0)));
 | 
			
		||||
module.exports = {
 | 
			
		||||
    on: EventHandler.listen.bind(EventHandler),
 | 
			
		||||
    disable: function (jsp) {
 | 
			
		||||
    disable: function(jsp) {
 | 
			
		||||
        var eventCache = EventHandler.listenerMap[jsp.description.name];
 | 
			
		||||
        if (eventCache) {
 | 
			
		||||
            eventCache.forEach(function (t) t.off.call(EventHandler));
 | 
			
		||||
            eventCache.forEach(function(t) { t.off.call(EventHandler) });
 | 
			
		||||
            delete EventHandler.listenerMap[jsp.description.name];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ function readPlugin(file) {
 | 
			
		||||
    }
 | 
			
		||||
    var plugin = require(file, {
 | 
			
		||||
        cache: false,
 | 
			
		||||
        hook: function (origin) {
 | 
			
		||||
        hook: function(origin) {
 | 
			
		||||
            return beforeLoadHook(origin);
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
@@ -172,7 +172,7 @@ function initPluginConfig(plugin) {
 | 
			
		||||
     * @constructor
 | 
			
		||||
     * @constructor (file|string)
 | 
			
		||||
     */
 | 
			
		||||
    plugin.getConfig = function () {
 | 
			
		||||
    plugin.getConfig = function() {
 | 
			
		||||
        switch (arguments.length) {
 | 
			
		||||
            case 0:
 | 
			
		||||
                return plugin.config;
 | 
			
		||||
@@ -181,7 +181,7 @@ function initPluginConfig(plugin) {
 | 
			
		||||
                if (!file.isFile) {
 | 
			
		||||
                    file = plugin.getFile(file);
 | 
			
		||||
                }
 | 
			
		||||
                return yaml.safeLoad(fs.read(file), {json: true});
 | 
			
		||||
                return yaml.safeLoad(fs.read(file), { json: true });
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
@@ -189,7 +189,7 @@ function initPluginConfig(plugin) {
 | 
			
		||||
     * @constructor
 | 
			
		||||
     * @constructor (file|string)
 | 
			
		||||
     */
 | 
			
		||||
    plugin.reloadConfig = function () {
 | 
			
		||||
    plugin.reloadConfig = function() {
 | 
			
		||||
        plugin.config = plugin.getConfig(plugin.configFile);
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
@@ -197,7 +197,7 @@ function initPluginConfig(plugin) {
 | 
			
		||||
     * @constructor
 | 
			
		||||
     * @constructor (file, content)
 | 
			
		||||
     */
 | 
			
		||||
    plugin.saveConfig = function () {
 | 
			
		||||
    plugin.saveConfig = function() {
 | 
			
		||||
        switch (arguments.length) {
 | 
			
		||||
            case 0:
 | 
			
		||||
                fs.save(plugin.configFile, yaml.safeDump(plugin.config));
 | 
			
		||||
@@ -273,13 +273,15 @@ function disable() {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function reload() {
 | 
			
		||||
    checkAndGet(arguments).forEach(function (p) {
 | 
			
		||||
function reloadPlugin(p) {
 | 
			
		||||
    disable(p);
 | 
			
		||||
    p = loadPlugin(p.__FILE__);
 | 
			
		||||
    load(p);
 | 
			
		||||
    enable(p);
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function reload() {
 | 
			
		||||
    checkAndGet(arguments).forEach(reloadPlugin);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// noinspection JSUnresolvedVariable
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ var Bukkit = MServer;
 | 
			
		||||
/**
 | 
			
		||||
 * 获取NMS版本
 | 
			
		||||
 */
 | 
			
		||||
var nmsVersion = Bukkit.class.name.split('.')[3];
 | 
			
		||||
var nmsVersion = Bukkit.server.class.name.split('.')[3];
 | 
			
		||||
/**
 | 
			
		||||
 * 获取NMS类
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user