/**
* Sets lore to a players armor
*
* @param player {@code ItemMeta} to set lore for armor
* @param str Lore string
*/
public static void setLore(Player player, String str) {
List<String> lores = new ArrayList<String>();
ItemStack[] armor = player.getInventory().getArmorContents();
lores.add(str);
ItemMeta meta;
for (ItemStack is : armor) {
if (is != null && (meta = is.getItemMeta()) instanceof LeatherArmorMeta) {
if (meta.hasLore()) {
List<String> localAdd = new ArrayList<String>();
for (String l : meta.getLore()) {
if (!l.startsWith(Lang.TITLE_PREFIX.toString() + "|")) {
localAdd.add(l);
}
}
lores.addAll(localAdd);
}
meta.setLore(lores);
is.setItemMeta(meta);
}
}
}
Utility.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:RBGArmor
作者:
评论列表
文章目录