From ddbaabd688cf749fcd98fb2ba8224d889df382eb Mon Sep 17 00:00:00 2001 From: coding Date: Thu, 30 Nov 2017 05:24:27 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0server=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/internal/bukkit/server.js | 8 +++---- src/main/resources/internal/sponge/server.js | 24 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/main/resources/internal/bukkit/server.js b/src/main/resources/internal/bukkit/server.js index c709008..58ab6f0 100644 --- a/src/main/resources/internal/bukkit/server.js +++ b/src/main/resources/internal/bukkit/server.js @@ -27,9 +27,9 @@ exports.player = function () { case 0: return undefined; case 1: - return Bukkit.getPlayer(arguments[0]); + return Server.getPlayer(arguments[0]); default: - return Bukkit.getPlayerExtra(arguments[0]); + return Server.getPlayerExtra(arguments[0]); } }; /** @@ -38,9 +38,9 @@ exports.player = function () { exports.players = function () { switch (arguments.length) { case 1: - return Bukkit.onlinePlayers.forEach(arguments[0]); + return Server.onlinePlayers.forEach(arguments[0]); default: - return Bukkit.onlinePlayers; + return Server.onlinePlayers; } }; /** diff --git a/src/main/resources/internal/sponge/server.js b/src/main/resources/internal/sponge/server.js index 4707729..ff1fd6e 100644 --- a/src/main/resources/internal/sponge/server.js +++ b/src/main/resources/internal/sponge/server.js @@ -39,4 +39,28 @@ exports.plugin = { return PluginManager.isPluginEnabled(name); }, self: PluginManager.getPlugin('miaoscript').get() +}; +/** + * 获取玩家 + */ +exports.player = function () { + switch (arguments.length) { + case 0: + return undefined; + case 1: + return Server.getPlayer(arguments[0]).get(); + default: + return Server.getPlayer(arguments[0]).get(); + } +}; +/** + * 获取在线玩家 + */ +exports.players = function () { + switch (arguments.length) { + case 1: + return Server.onlinePlayers.forEach(arguments[0]); + default: + return Server.onlinePlayers; + } }; \ No newline at end of file