mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-21 09:21:21 +01:00
Added %mmoitems_stat_defense_percent% placeholder
Updated lib.
This commit is contained in:
parent
f76e93b5bb
commit
81403fe77d
BIN
lib/MMOLib.jar
BIN
lib/MMOLib.jar
Binary file not shown.
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user