From 90e0c349a4f50ede77b0758503c66396d6a80cae Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Thu, 1 Jun 2023 08:41:55 +0100 Subject: [PATCH] Fixed a bug related to lore parsing in skill-list.yml --- .../net/Indyuce/mmocore/gui/SkillList.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java index b824cb7c..612be472 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/gui/SkillList.java @@ -200,17 +200,19 @@ public class SkillList extends EditableInventory { List lore = new ArrayList<>(getLore()); int index = lore.indexOf("{slot-lore}"); - lore.remove(index); - List slotLore = skillSlot.getLore(); - for (int j = 0; j < slotLore.size(); j++) - lore.add(index + j, slotLore.get(j)); - + if (index != -1) { + lore.remove(index); + List slotLore = skillSlot.getLore(); + for (int j = 0; j < slotLore.size(); j++) + lore.add(index + j, slotLore.get(j)); + } index = lore.indexOf("{skill-lore}"); - lore.remove(index); - List skillLore = boundSkill == null ? new ArrayList() : boundSkill.calculateLore(inv.getPlayerData()); - for (int j = 0; j < skillLore.size(); j++) - lore.add(index + j, skillLore.get(j)); - + if (index != -1) { + lore.remove(index); + List skillLore = boundSkill == null ? new ArrayList() : boundSkill.calculateLore(inv.getPlayerData()); + for (int j = 0; j < skillLore.size(); j++) + lore.add(index + j, skillLore.get(j)); + } for (int j = 0; j < lore.size(); j++) lore.set(j, ChatColor.GRAY + holders.apply(inv.getPlayer(), lore.get(j)));