Changed PlayerClass to make it compatible with SkillSlots

This commit is contained in:
Ka0rX 2023-03-09 19:00:38 +01:00
parent e9a7097a8d
commit 8e37898d33

View File

@ -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.ManaDisplayOptions;
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource; 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.resource.ResourceRegeneration;
import net.Indyuce.mmocore.api.player.profess.skillslot.SkillSlot;
import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.MMOCoreUtils;
import net.Indyuce.mmocore.api.util.math.formula.LinearValue; import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
import net.Indyuce.mmocore.experience.EXPSource; import net.Indyuce.mmocore.experience.EXPSource;
@ -67,8 +68,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
@Nullable @Nullable
private final CastingParticle castParticle; private final CastingParticle castParticle;
private final int maxBoundActiveSkills, maxBoundPassiveSkills; private final List<SkillSlot> skillSlots= new ArrayList<>();
private final List<SkillTree> skillTrees = new ArrayList<>(); private final List<SkillTree> skillTrees = new ArrayList<>();
private final List<PassiveSkill> classScripts = new LinkedList(); private final List<PassiveSkill> classScripts = new LinkedList();
private final Map<String, LinearValue> stats = new HashMap<>(); private final Map<String, LinearValue> stats = new HashMap<>();
@ -103,7 +103,9 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
| SecurityException exception) { | SecurityException exception) {
throw new IllegalArgumentException("Could not apply playerhead texture: " + exception.getMessage()); 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")) for (String string : config.getStringList("display.lore"))
description.add(ChatColor.GRAY + MythicLib.plugin.parseColors(string)); description.add(ChatColor.GRAY + MythicLib.plugin.parseColors(string));
for (String string : config.getStringList("display.attribute-lore")) for (String string : config.getStringList("display.attribute-lore"))
@ -118,8 +120,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
? MMOCore.plugin.experience.getCurveOrThrow( ? MMOCore.plugin.experience.getCurveOrThrow(
config.get("exp-curve").toString().toLowerCase().replace("_", "-").replace(" ", "-")) config.get("exp-curve").toString().toLowerCase().replace("_", "-").replace(" ", "-"))
: ExpCurve.DEFAULT; : 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; ExperienceTable expTable = null;
if (config.contains("exp-table")) if (config.contains("exp-table"))
try { try {
@ -252,8 +252,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
this.icon = new ItemStack(material); this.icon = new ItemStack(material);
setOption(ClassOption.DISPLAY, false); setOption(ClassOption.DISPLAY, false);
setOption(ClassOption.DEFAULT, false); setOption(ClassOption.DEFAULT, false);
maxBoundActiveSkills = 6;
maxBoundPassiveSkills = 3;
for (PlayerResource resource : PlayerResource.values()) for (PlayerResource resource : PlayerResource.values())
resourceHandlers.put(resource, new ResourceRegeneration(resource)); resourceHandlers.put(resource, new ResourceRegeneration(resource));
} }
@ -309,13 +307,6 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
return expCurve; return expCurve;
} }
public int getMaxBoundActiveSkills() {
return maxBoundActiveSkills;
}
public int getMaxBoundPassiveSkills() {
return maxBoundPassiveSkills;
}
@NotNull @NotNull
public ExperienceTable getExperienceTable() { public ExperienceTable getExperienceTable() {