feat: 更新server模块

This commit is contained in:
coding 2017-11-30 05:24:27 +00:00
parent 5ac394cdbb
commit ddbaabd688
2 changed files with 28 additions and 4 deletions

View File

@ -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;
}
};
/**

View File

@ -40,3 +40,27 @@ exports.plugin = {
},
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;
}
};