From 7585ba243bd6e03b858594e10dc8498d0e7aa9b9 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Sun, 3 Jul 2022 10:48:05 +0200 Subject: [PATCH] PAPI support for Action Bar --- src/main/java/net/Indyuce/mmocore/gui/AttributeView.java | 5 +++++ .../java/net/Indyuce/mmocore/gui/api/EditableInventory.java | 1 + .../net/Indyuce/mmocore/skill/cast/listener/SkillBar.java | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java index 4cd7409f..6c041919 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java +++ b/src/main/java/net/Indyuce/mmocore/gui/AttributeView.java @@ -79,14 +79,19 @@ public class AttributeView extends EditableInventory { StatInfo info = StatInfo.valueOf(buff.getStat()); holders.register("buff_" + buff.getStat().toLowerCase(), info.format(buff.getValue())); holders.register("total_" + buff.getStat().toLowerCase(), info.format(buff.multiply(total).getValue())); + Bukkit.broadcastMessage(info.format(0.34)); + Bukkit.broadcastMessage((new DecimalFormat(null)==null)+""); }); + return holders; } } public class AttributeViewerInventory extends GeneratedInventory { + public AttributeViewerInventory(PlayerData playerData, EditableInventory editable) { super(playerData, editable); + } @Override diff --git a/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java b/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java index f650ba9d..5660ded8 100644 --- a/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java +++ b/src/main/java/net/Indyuce/mmocore/gui/api/EditableInventory.java @@ -40,6 +40,7 @@ public abstract class EditableInventory { this.slots = Math.min(Math.max(9, config.getInt("slots")), 54); Validate.isTrue((slots % 9) == 0, "Slots must be a multiple of 9"); + items.clear(); if (config.contains("items")) { Validate.notNull(config.getConfigurationSection("items"), "Could not load item list"); diff --git a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java index 46bac2f1..99329793 100644 --- a/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java +++ b/src/main/java/net/Indyuce/mmocore/skill/cast/listener/SkillBar.java @@ -105,8 +105,7 @@ public class SkillBar implements Listener { "" + (j + 1 + (data.getPlayer().getInventory().getHeldItemSlot() <= j ? 1 : 0))) .replace("{skill}", data.getBoundSkill(j).getSkill().getName())); } - - return str.toString(); + return MMOCore.plugin.placeholderParser.parse(data.getPlayer(),str.toString()); } /**