forked from Upstream/mmocore
Fixed issue #806 about skill slot lore not displaying on GUI and modified slightly skill-list.yml GUI for that.
This commit is contained in:
parent
f3aa07288f
commit
fc91ace143
@ -1,5 +1,6 @@
|
||||
package net.Indyuce.mmocore.gui;
|
||||
|
||||
import io.lumine.mythic.core.utils.MythicUtil;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
@ -193,6 +194,7 @@ public class SkillList extends EditableInventory {
|
||||
|
||||
final @Nullable ClassSkill boundSkill = inv.getPlayerData().getBoundSkill(n + 1);
|
||||
final ItemStack item = super.display(inv, n);
|
||||
Placeholders holders = getPlaceholders(inv, n);
|
||||
|
||||
// Same material as skill
|
||||
if (boundSkill != null)
|
||||
@ -201,6 +203,17 @@ public class SkillList extends EditableInventory {
|
||||
final ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(MMOCore.plugin.placeholderParser.parse(inv.getPlayerData().getPlayer(), skillSlot.getName()));
|
||||
|
||||
List<String> lore = new ArrayList<>(getLore());
|
||||
|
||||
int index = lore.indexOf("{slot-lore}");
|
||||
lore.remove(index);
|
||||
List<String> slotLore = skillSlot.getLore();
|
||||
for (int j = 0; j < slotLore.size(); j++)
|
||||
lore.add(index + j, slotLore.get(j));
|
||||
|
||||
for (int j = 0; j < lore.size(); j++)
|
||||
lore.set(j, ChatColor.GRAY + holders.apply(inv.getPlayer(), lore.get(j)));
|
||||
meta.setLore(lore);
|
||||
// Same CMD as skill icon
|
||||
if (boundSkill != null && boundSkill.getSkill().getIcon().hasItemMeta() && boundSkill.getSkill().getIcon().getItemMeta().hasCustomModelData())
|
||||
meta.setCustomModelData(boundSkill.getSkill().getIcon().getItemMeta().getCustomModelData());
|
||||
@ -209,17 +222,12 @@ public class SkillList extends EditableInventory {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* This should only be called when there is a skill bound.
|
||||
*/
|
||||
@Override
|
||||
public Placeholders getPlaceholders(SkillViewerInventory inv, int n) {
|
||||
RegisteredSkill selected = inv.selected.getSkill();
|
||||
|
||||
final @NotNull SkillSlot skillSlot = inv.getPlayerData().getProfess().getSkillSlot(n + 1);
|
||||
Placeholders holders = new Placeholders();
|
||||
|
||||
holders.register("index", "" + (n + 1));
|
||||
holders.register("slot", MMOCoreUtils.intToRoman(n + 1));
|
||||
holders.register("slot", skillSlot.getName());
|
||||
holders.register("selected", selected == null ? none : selected.getName());
|
||||
RegisteredSkill skill = inv.getPlayerData().hasSkillBound(n + 1) ? inv.getPlayerData().getBoundSkill(n + 1).getSkill() : null;
|
||||
holders.register("skill", skill == null ? none : skill.getName());
|
||||
|
@ -56,6 +56,8 @@ items:
|
||||
lore:
|
||||
- '&7Current Skill: &6{skill}'
|
||||
- ''
|
||||
- '{slot-lore}'
|
||||
- ''
|
||||
- '&7&oCast this spell by pressing [F] followed'
|
||||
- '&7&oby the keybind displayed on the action bar.'
|
||||
- ''
|
||||
|
Loading…
Reference in New Issue
Block a user