From 8e37898d33549cb6499e8c38b51b44634f26eb4b Mon Sep 17 00:00:00 2001 From: Ka0rX Date: Thu, 9 Mar 2023 19:00:38 +0100 Subject: [PATCH] Changed PlayerClass to make it compatible with SkillSlots --- .../api/player/profess/PlayerClass.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java index c3d8b283..42012926 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/profess/PlayerClass.java @@ -21,6 +21,7 @@ import net.Indyuce.mmocore.api.player.profess.event.EventTrigger; import net.Indyuce.mmocore.api.player.profess.resource.ManaDisplayOptions; import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; import net.Indyuce.mmocore.api.player.profess.resource.ResourceRegeneration; +import net.Indyuce.mmocore.api.player.profess.skillslot.SkillSlot; import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.experience.EXPSource; @@ -67,8 +68,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { @Nullable private final CastingParticle castParticle; - private final int maxBoundActiveSkills, maxBoundPassiveSkills; - + private final List skillSlots= new ArrayList<>(); private final List skillTrees = new ArrayList<>(); private final List classScripts = new LinkedList(); private final Map stats = new HashMap<>(); @@ -103,7 +103,9 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { | SecurityException exception) { throw new IllegalArgumentException("Could not apply playerhead texture: " + exception.getMessage()); } - + for (String key : config.getConfigurationSection("skill-slots").getKeys(false)) { + skillSlots.add(new SkillSlot(config.getConfigurationSection("skill-slots." + key))); + } for (String string : config.getStringList("display.lore")) description.add(ChatColor.GRAY + MythicLib.plugin.parseColors(string)); for (String string : config.getStringList("display.attribute-lore")) @@ -118,8 +120,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { ? MMOCore.plugin.experience.getCurveOrThrow( config.get("exp-curve").toString().toLowerCase().replace("_", "-").replace(" ", "-")) : ExpCurve.DEFAULT; - maxBoundActiveSkills = config.getInt("max-bound-active-skills", MMOCore.plugin.configManager.maxBoundActiveSkills); - maxBoundPassiveSkills = config.getInt("max-bound-passive-skills", MMOCore.plugin.configManager.maxBoundPassiveSkills); ExperienceTable expTable = null; if (config.contains("exp-table")) try { @@ -252,8 +252,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { this.icon = new ItemStack(material); setOption(ClassOption.DISPLAY, false); setOption(ClassOption.DEFAULT, false); - maxBoundActiveSkills = 6; - maxBoundPassiveSkills = 3; for (PlayerResource resource : PlayerResource.values()) resourceHandlers.put(resource, new ResourceRegeneration(resource)); } @@ -309,13 +307,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject { return expCurve; } - public int getMaxBoundActiveSkills() { - return maxBoundActiveSkills; - } - - public int getMaxBoundPassiveSkills() { - return maxBoundPassiveSkills; - } @NotNull public ExperienceTable getExperienceTable() {