public void applyAbility(Player player, ItemStack item, Ability ability, boolean temporary) {
// Adding lore
ItemMeta meta = item.getItemMeta();
List<String> lore = meta.hasLore() ?
meta.getLore() : new ArrayList<>();
lore.add(ChatColor.GRAY + "Ability: " + ChatColor.RED + ability.getName());
if(temporary)
lore.add(ChatColor.GRAY + "Temporary");
meta.setLore(lore);
item.setItemMeta(meta);
player.getInventory().setItemInMainHand(item);
if(!temporary)
return;
// Adding timer for temporary abilities
new BukkitRunnable() {
@Override
public void run() {
if(!isActive(player, item)) {
this.cancel();
}
updateTemporaryItem(player, item, ability);
player.sendMessage(Lang.HEADERS_TOKENS.toString()
+ Lang.TOKENS_SHOP_EXPIRED.toString()
.replaceAll("%s", ability.getName()));
}
}.runTaskLater(plugin, 100 * 60 * 20);
}
AbilityManager.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:AsgardAscension
作者:
评论列表
文章目录