feat: 新增 Console 和 reflect 部分完善 command

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
2017-10-10 21:01:43 +08:00
parent 59b2824413
commit d0b43487c2
14 changed files with 281 additions and 95 deletions

View File

@ -0,0 +1,24 @@
'use strict';
/**
* PAPI扩展类
*/
/*global Java, base, module, exports, require, __FILE__*/
var PlaceholderAPI;
var bukkit = require('modules/bukkit');
if (bukkit.plugin.load("PlaceholderAPI")) {
PlaceholderAPI = ext.getStatic("me.clip.placeholderapi.PlaceholderAPI");
} else {
log.w("PlaceholderAPI 未找到 变量替换功能失效!");
PlaceholderAPI = {
setPlaceholders: function () {
return arguments[1];
}
}
}
exports.$ = function () {
if (arguments.length > 1) {
return PlaceholderAPI.setPlaceholders(arguments[0], arguments[1]);
} else {
return PlaceholderAPI.setPlaceholders(null, arguments[0]);
}
};

View File

@ -4,7 +4,6 @@
*/
/*global Java, base, module, exports, require*/
var papi = require("modules/ext/papi");
var event = require('modules/event');
var join;
@ -14,17 +13,17 @@ var description = {
};
function load() {
log.i('载入 Hello Wrold 测试插件!');
console.log('载入 Hello Wrold 测试插件!');
}
function enable() {
log.i('启用 Hello Wrold 测试插件!');
console.log('启用 Hello Wrold 测试插件!');
join = event.on('playerloginevent', function join(event) {
// noinspection JSUnresolvedVariable
log.d('玩家 %s 触发事件 %s', event.player.name, event.name);
setTimeout(function () {
// noinspection JSUnresolvedVariable
event.player.sendMessage(papi.$(event.player, "§a欢迎来到 §bMiaoScript §a的世界! 当前在线: %server_online%"));
event.player.sendMessage(require("plugins/ext/papi").$(event.player, "§a欢迎来到 §bMiaoScript §a的世界! 当前在线: %server_online%"));
}, 10);
});
}