diff --git a/lib/MMOLib.jar b/lib/MMOLib.jar index f7714526..858412ff 100644 Binary files a/lib/MMOLib.jar and b/lib/MMOLib.jar differ diff --git a/src/main/java/net/Indyuce/mmoitems/comp/parse/placeholders/MMOItemsPlaceholders.java b/src/main/java/net/Indyuce/mmoitems/comp/parse/placeholders/MMOItemsPlaceholders.java index 489f5e8e..83973e59 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/parse/placeholders/MMOItemsPlaceholders.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/parse/placeholders/MMOItemsPlaceholders.java @@ -2,6 +2,8 @@ package net.Indyuce.mmoitems.comp.parse.placeholders; import java.text.DecimalFormat; +import net.mmogroup.mmolib.api.player.MMOPlayerData; +import net.mmogroup.mmolib.listener.DamageReduction; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -33,12 +35,17 @@ public class MMOItemsPlaceholders extends PlaceholderExpansion { } public String onPlaceholderRequest(Player player, String identifier) { + // registering before identifier.startsWith("stat_") to prevent issues + // i don't register it in the starts with condition because it will mess with substring + if (identifier.equals("stat_defense_percent")) + return twoDigits.format(new DamageReduction.DefenseCalculator(MMOPlayerData.get(player)).getReductionPercent()) + "%"; if (identifier.startsWith("stat_")) { ItemStat stat = MMOItems.plugin.getStats().get(identifier.substring(5).toUpperCase()); if (stat != null) return twoDigits.format(PlayerData.get(player).getStats().getStat(stat)); } + if (identifier.startsWith("ability_cd_")) { PlayerData data = PlayerData.get(player); return data.hasCooldownInfo(identifier.substring(11)) ? oneDigit.format(data.getCooldownInfo(identifier.substring(11)).getRemaining())