feat: PAPI支持直接替换数组

This commit is contained in:
coding 2018-05-19 17:09:14 +00:00
parent 8f5bae006a
commit e6af7b1828

View File

@ -37,11 +37,16 @@ try {
}
function replace() {
if (arguments.length > 1) {
return PlaceholderAPI.setPlaceholders(arguments[0], arguments[1]);
} else {
return PlaceholderAPI.setPlaceholders(null, arguments[0]);
var player = arguments[0];
var line = [];
if (arguments.length === 1) {
player = null;
line = player;
}
if (toString.call(line) === "[object Array]") {
return PlaceholderAPI.setPlaceholders(player, line.join('\n')).split('\n');
}
return PlaceholderAPI.setPlaceholders(player, line);
}
exports = module.exports = {