From a76d77fe478aace3c40bfaabbf295b3063afabe5 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 9 Jul 2023 22:05:22 +0100 Subject: [PATCH] Added placeholder %mmocore_cooldown_bound_% according to issue #890. --- .../comp/placeholder/RPGPlaceholders.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java index 10378710..52019585 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/comp/placeholder/RPGPlaceholders.java @@ -72,8 +72,8 @@ public class RPGPlaceholders extends PlaceholderExpansion { String id = identifier.substring(12); RegisteredSkill skill = Objects.requireNonNull(MMOCore.plugin.skillManager.getSkill(id), "Could not find skill with ID '" + id + "'"); return String.valueOf(playerData.getSkillLevel(skill)); - } else if (identifier.startsWith("skill_modifier_")||identifier.startsWith("skill_parameter_")) { - String[] ids= (identifier.startsWith("skill_modifier_")?identifier.substring(15):identifier.substring(16)).split(":"); + } else if (identifier.startsWith("skill_modifier_") || identifier.startsWith("skill_parameter_")) { + String[] ids = (identifier.startsWith("skill_modifier_") ? identifier.substring(15) : identifier.substring(16)).split(":"); String parameterId = ids[0]; String skillId = ids[1]; RegisteredSkill skill = Objects.requireNonNull(MMOCore.plugin.skillManager.getSkill(skillId), "Could not find skill with ID '" + skillId + "'"); @@ -129,9 +129,17 @@ public class RPGPlaceholders extends PlaceholderExpansion { else if (identifier.startsWith("bound_")) { int slot = Math.max(0, Integer.parseInt(identifier.substring(6))); - return playerData.hasSkillBound(slot) ? playerData.getBoundSkill(slot).getSkill().getName() - : MMOCore.plugin.configManager.noSkillBoundPlaceholder; - + if (playerData.hasSkillBound(slot)) { + ClassSkill skill = playerData.getBoundSkill(slot); + return (playerData.getCooldownMap().isOnCooldown(skill) ? ChatColor.RED : ChatColor.GREEN) + skill.getSkill().getName(); + } else + return MMOCore.plugin.configManager.noSkillBoundPlaceholder; + } else if (identifier.startsWith("cooldown_bound_")) { + int slot = Math.max(0, Integer.parseInt(identifier.substring(15))); + if (playerData.hasSkillBound(slot)) + return "" + playerData.getCooldownMap().getCooldown(playerData.getBoundSkill(slot)); + else + return MMOCore.plugin.configManager.noSkillBoundPlaceholder; } else if (identifier.startsWith("profession_experience_")) return MythicLib.plugin.getMMOConfig().decimal.format( playerData.getCollectionSkills().getExperience(identifier.substring(22).replace(" ", "-").replace("_", "-").toLowerCase()));