More cleanup

This commit is contained in:
Indyuce 2022-11-10 18:01:40 +01:00
parent 5f2c2f591f
commit 6d21b40ce9
2 changed files with 17 additions and 26 deletions

View File

@ -6,8 +6,6 @@ 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.party.provided.MMOCorePartyModule;
import net.Indyuce.mmocore.party.provided.Party;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.ConfigMessage;
import net.Indyuce.mmocore.api.SoundEvent;
@ -34,8 +32,9 @@ import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
import net.Indyuce.mmocore.guild.provided.Guild;
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
import net.Indyuce.mmocore.party.AbstractParty;
import net.Indyuce.mmocore.party.provided.MMOCorePartyModule;
import net.Indyuce.mmocore.party.provided.Party;
import net.Indyuce.mmocore.player.Unlockable;
import net.Indyuce.mmocore.player.stats.StatInfo;
import net.Indyuce.mmocore.skill.ClassSkill;
import net.Indyuce.mmocore.skill.RegisteredSkill;
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
@ -119,8 +118,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
private final Map<String, Integer> tableItemClaims = new HashMap<>();
// NON-FINAL player data stuff made public to facilitate field change
public boolean noCooldown;
private final boolean statLoaded;
public boolean noCooldown, statsLoaded;
public CombatRunnable combat;
/**
@ -137,12 +135,12 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
playerStats = new PlayerStats(this);
// Used to see if the triggers need to be applied
boolean statLoaded = false;
for (StatInstance instance : mmoData.getStatMap().getInstances())
for (StatModifier modifier : instance.getModifiers())
if (modifier.getKey().startsWith("trigger"))
statLoaded = true;
this.statLoaded = statLoaded;
if (modifier.getKey().startsWith("trigger")) {
statsLoaded = true;
break;
}
}
/**
@ -172,27 +170,25 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
j++;
}
for (SkillTree skillTree : profess.getSkillTrees()) {
for (SkillTreeNode node : skillTree.getNodes()) {
for (SkillTree skillTree : getProfess().getSkillTrees())
for (SkillTreeNode node : skillTree.getNodes())
if (!nodeLevels.containsKey(node))
nodeLevels.put(node, 0);
}
}
setupSkillTree();
}
public void setupSkillTree() {
//Node states setup
for (SkillTree skillTree : profess.getSkillTrees())
// Node states setup
for (SkillTree skillTree : getProfess().getSkillTrees())
skillTree.setupNodeState(this);
// Stat triggers setup
if (!statLoaded) {
if (!statsLoaded) {
for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll())
for (SkillTreeNode node : skillTree.getNodes())
node.getExperienceTable().claimStatTriggers(this, node);
statLoaded = true;
statsLoaded = true;
}
}
@ -206,7 +202,6 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
public void clearPointsSpent() {
pointSpent.clear();
}
public void setSkillTreePoints(String treeId, int points) {
@ -228,27 +223,23 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
return new HashMap(skillTreePoints);
}
public void clearSkillTreePoints() {
skillTreePoints.clear();
}
public boolean containsSkillPointTreeId(String treeId) {
return skillTreePoints.containsKey(treeId);
}
public Set<Map.Entry<String, Integer>> getNodeLevelsEntrySet() {
HashMap<String, Integer> nodeLevelsString = new HashMap<>();
for (SkillTreeNode node : nodeLevels.keySet()) {
for (SkillTreeNode node : nodeLevels.keySet())
nodeLevelsString.put(node.getFullId(), nodeLevels.get(node));
}
return nodeLevelsString.entrySet();
}
public boolean isStatLoaded() {
return statLoaded;
public boolean areStatsLoaded() {
return statsLoaded;
}
public Map<SkillTreeNode, Integer> getNodeLevels() {

View File

@ -100,7 +100,7 @@ public class PlayerProfessions {
for (Entry<String, JsonElement> entry : obj.getAsJsonObject("timesClaimed").entrySet())
playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt());
if (!playerData.isStatLoaded())
if (!playerData.areStatsLoaded())
for (Profession profession : MMOCore.plugin.professionManager.getAll()) {
if (profession.hasExperienceTable())
profession.getExperienceTable().claimStatTriggers(playerData, profession);