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