From 81f245a4ce0d1fa1c70ebf6a16046aee9b2b8229 Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Thu, 9 Mar 2023 23:10:49 +0100 Subject: [PATCH] Removed passive skill from the skill list GUI --- .../mmocore/api/player/PlayerData.java | 11 ++- .../net/Indyuce/mmocore/gui/SkillList.java | 81 +------------------ 2 files changed, 8 insertions(+), 84 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index d7482c87..acc08edc 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -5,7 +5,6 @@ import io.lumine.mythic.lib.api.player.MMOPlayerData; import io.lumine.mythic.lib.api.stat.StatInstance; import io.lumine.mythic.lib.api.stat.modifier.StatModifier; import io.lumine.mythic.lib.player.cooldown.CooldownMap; -import io.lumine.mythic.lib.player.skill.PassiveSkill; import net.Indyuce.mmocore.MMOCore; import net.Indyuce.mmocore.api.ConfigMessage; import net.Indyuce.mmocore.api.SoundEvent; @@ -82,7 +81,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc @Nullable private PlayerClass profess; private int level, classPoints, skillPoints, attributePoints, attributeReallocationPoints; - private int numberSlots, skillTreeReallocationPoints, skillReallocationPoints; + private int skillSlotLimit, skillTreeReallocationPoints, skillReallocationPoints; private double experience; private double mana, stamina, stellium; private Guild guild; @@ -459,12 +458,12 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc return skillPoints; } - public int getNumberSlots() { - return numberSlots; + public int getSkillSlotLimit() { + return skillSlotLimit; } - public void setNumberSlots(int numberSlots) { - this.numberSlots = numberSlots; + public void setSkillSlotLimit(int skillSlotLimit) { + this.skillSlotLimit = skillSlotLimit; } public void giveSkillReallocationPoints(int value) { 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 0c0ee123..1b5ef874 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 @@ -61,11 +61,11 @@ public class SkillList extends EditableInventory { }; } - if (function.equals("active-slot")) + if (function.equals("slot")) return new SlotItem(config) { @Override public ItemStack display(SkillViewerInventory inv, int n) { - if (n >= inv.getPlayerData().getProfess().getMaxBoundActiveSkills()) { + if (n >= inv.getPlayerData().getSkillSlotLimit()) { return new ItemStack(Material.AIR); } ItemStack item = super.display(inv, n); @@ -91,38 +91,6 @@ public class SkillList extends EditableInventory { } }; - if (function.equals("passive-slot")) - return new SlotItem(config) { - @Override - public ItemStack display(SkillViewerInventory inv, int n) { - if (n >= inv.getPlayerData().getProfess().getMaxBoundPassiveSkills()) { - return new ItemStack(Material.AIR); - } - ItemStack item = super.display(inv, n); - if (!inv.getPlayerData().hasPassiveSkillBound(n)) { - item.setType(super.emptyMaterial); - - if (MythicLib.plugin.getVersion().isStrictlyHigher(1, 13)) { - ItemMeta meta = item.getItemMeta(); - meta.setCustomModelData(super.emptyCMD); - item.setItemMeta(meta); - } - } - return item; - } - - - @Override - public Placeholders getPlaceholders(SkillViewerInventory inv, int n) { - Placeholders holders= super.getPlaceholders(inv, n); - String none = MythicLib.plugin.parseColors(config.getString("no-skill")); - RegisteredSkill skill = inv.getPlayerData().hasPassiveSkillBound(n) ? - MMOCore.plugin.skillManager.getSkill(inv.getPlayerData().getBoundPassiveSkill(n).getTriggeredSkill().getHandler().getId()) - : null; - holders.register("skill", skill == null ? none : skill.getName()); - return holders; - } - }; if (function.equals("previous")) return new SimplePlaceholderItem(config) { @@ -408,49 +376,6 @@ public class SkillList extends EditableInventory { return; } - /* - * binding or unbinding passive skills. - */ - - if (item.getFunction().equals("passive-slot")) { - int index = passiveSlotSlots.indexOf(context.getSlot()); - - // unbind if there is a current spell. - if (context.getClickType() == ClickType.RIGHT) { - if (!playerData.hasPassiveSkillBound(index)) { - MMOCore.plugin.configManager.getSimpleMessage("no-skill-bound").send(player); - player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); - return; - } - player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2); - playerData.unbindPassiveSkill(index); - open(); - return; - } - - if (selected == null) - return; - - if (!selected.getSkill().getTrigger().isPassive()) { - MMOCore.plugin.configManager.getSimpleMessage("not-passive-skill").send(player); - player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); - return; - } - - - if (!playerData.hasSkillUnlocked(selected)) { - MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(player); - player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 2); - return; - } - - player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2); - playerData.bindPassiveSkill(index, selected.toPassive(playerData)); - open(); - return; - } - - /* * binding or unbinding skills. */ @@ -487,7 +412,7 @@ public class SkillList extends EditableInventory { } player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 2); - playerData.bindActiveSkill(index, selected); + playerData.bindSkill(index, selected); open(); return; }