feat: 新增 Console 和 reflect 部分完善 command
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
24
src/main/resources/plugins/ext/papi.js
Normal file
24
src/main/resources/plugins/ext/papi.js
Normal 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]);
|
||||
}
|
||||
};
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user