From 08215ddc32342ef8dac4468e6aa7b8c97c08a56c Mon Sep 17 00:00:00 2001 From: coding Date: Sat, 14 Oct 2017 10:10:23 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8E=A9=E5=AE=B6=E5=88=97=E8=A1=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/modules/bukkit.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/main/resources/modules/bukkit.js b/src/main/resources/modules/bukkit.js index 216ec6e..259828f 100644 --- a/src/main/resources/modules/bukkit.js +++ b/src/main/resources/modules/bukkit.js @@ -9,7 +9,22 @@ var Bukkit = Java.type("org.bukkit.Bukkit"); // noinspection JSUnresolvedVariable var PluginManager = Bukkit.pluginManager; exports.$ = Bukkit; +/** + * 获取NMS版本 + */ exports.nmsVersion = Bukkit.server.class.name.split('.')[3]; +/** + * 获取NMS类 + */ +exports.nmsCls = function (name) { + return Java.type(['net.minecraft.server', exports.nmsVersion, name].join('.')); +} +/** + * 获取在线玩家 + */ +exports.players = function (func) { + return Bukkit.onlinePlayers.forEach(func); +}; /** * 插件管理 * @type {{manager: *, get: exports.plugin.get, load: exports.plugin.load}} @@ -40,9 +55,6 @@ exports.plugin = { return PluginManager.isPluginEnabled(name); } }; -exports.nmsCls = function (name){ - return Java.type(['net.minecraft.server', exports.nmsVersion, name].join('.')); -} /** * 公告 * @param message 消息