forked from Upstream/mmocore
More cleanup
This commit is contained in:
parent
5f2c2f591f
commit
6d21b40ce9
@ -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.api.stat.modifier.StatModifier;
|
||||||
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
import io.lumine.mythic.lib.player.cooldown.CooldownMap;
|
||||||
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
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.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||||
import net.Indyuce.mmocore.api.SoundEvent;
|
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.guild.provided.Guild;
|
||||||
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
import net.Indyuce.mmocore.loot.chest.particle.SmallParticleEffect;
|
||||||
import net.Indyuce.mmocore.party.AbstractParty;
|
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.Unlockable;
|
||||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
|
||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
import net.Indyuce.mmocore.skill.cast.SkillCastingHandler;
|
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<>();
|
private final Map<String, Integer> tableItemClaims = new HashMap<>();
|
||||||
|
|
||||||
// NON-FINAL player data stuff made public to facilitate field change
|
// NON-FINAL player data stuff made public to facilitate field change
|
||||||
public boolean noCooldown;
|
public boolean noCooldown, statsLoaded;
|
||||||
private final boolean statLoaded;
|
|
||||||
public CombatRunnable combat;
|
public CombatRunnable combat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,12 +135,12 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
playerStats = new PlayerStats(this);
|
playerStats = new PlayerStats(this);
|
||||||
|
|
||||||
// Used to see if the triggers need to be applied
|
// Used to see if the triggers need to be applied
|
||||||
boolean statLoaded = false;
|
|
||||||
for (StatInstance instance : mmoData.getStatMap().getInstances())
|
for (StatInstance instance : mmoData.getStatMap().getInstances())
|
||||||
for (StatModifier modifier : instance.getModifiers())
|
for (StatModifier modifier : instance.getModifiers())
|
||||||
if (modifier.getKey().startsWith("trigger"))
|
if (modifier.getKey().startsWith("trigger")) {
|
||||||
statLoaded = true;
|
statsLoaded = true;
|
||||||
this.statLoaded = statLoaded;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,27 +170,25 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SkillTree skillTree : profess.getSkillTrees()) {
|
for (SkillTree skillTree : getProfess().getSkillTrees())
|
||||||
for (SkillTreeNode node : skillTree.getNodes()) {
|
for (SkillTreeNode node : skillTree.getNodes())
|
||||||
if (!nodeLevels.containsKey(node))
|
if (!nodeLevels.containsKey(node))
|
||||||
nodeLevels.put(node, 0);
|
nodeLevels.put(node, 0);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setupSkillTree();
|
setupSkillTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setupSkillTree() {
|
public void setupSkillTree() {
|
||||||
// Node states setup
|
// Node states setup
|
||||||
for (SkillTree skillTree : profess.getSkillTrees())
|
for (SkillTree skillTree : getProfess().getSkillTrees())
|
||||||
skillTree.setupNodeState(this);
|
skillTree.setupNodeState(this);
|
||||||
|
|
||||||
// Stat triggers setup
|
// Stat triggers setup
|
||||||
if (!statLoaded) {
|
if (!statsLoaded) {
|
||||||
for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll())
|
for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll())
|
||||||
for (SkillTreeNode node : skillTree.getNodes())
|
for (SkillTreeNode node : skillTree.getNodes())
|
||||||
node.getExperienceTable().claimStatTriggers(this, node);
|
node.getExperienceTable().claimStatTriggers(this, node);
|
||||||
statLoaded = true;
|
statsLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +202,6 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
|
|
||||||
public void clearPointsSpent() {
|
public void clearPointsSpent() {
|
||||||
pointSpent.clear();
|
pointSpent.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSkillTreePoints(String treeId, int points) {
|
public void setSkillTreePoints(String treeId, int points) {
|
||||||
@ -228,27 +223,23 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
return new HashMap(skillTreePoints);
|
return new HashMap(skillTreePoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void clearSkillTreePoints() {
|
public void clearSkillTreePoints() {
|
||||||
skillTreePoints.clear();
|
skillTreePoints.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean containsSkillPointTreeId(String treeId) {
|
public boolean containsSkillPointTreeId(String treeId) {
|
||||||
return skillTreePoints.containsKey(treeId);
|
return skillTreePoints.containsKey(treeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Map.Entry<String, Integer>> getNodeLevelsEntrySet() {
|
public Set<Map.Entry<String, Integer>> getNodeLevelsEntrySet() {
|
||||||
HashMap<String, Integer> nodeLevelsString = new HashMap<>();
|
HashMap<String, Integer> nodeLevelsString = new HashMap<>();
|
||||||
for (SkillTreeNode node : nodeLevels.keySet()) {
|
for (SkillTreeNode node : nodeLevels.keySet())
|
||||||
nodeLevelsString.put(node.getFullId(), nodeLevels.get(node));
|
nodeLevelsString.put(node.getFullId(), nodeLevels.get(node));
|
||||||
}
|
|
||||||
return nodeLevelsString.entrySet();
|
return nodeLevelsString.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatLoaded() {
|
public boolean areStatsLoaded() {
|
||||||
return statLoaded;
|
return statsLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<SkillTreeNode, Integer> getNodeLevels() {
|
public Map<SkillTreeNode, Integer> getNodeLevels() {
|
||||||
|
@ -100,7 +100,7 @@ public class PlayerProfessions {
|
|||||||
for (Entry<String, JsonElement> entry : obj.getAsJsonObject("timesClaimed").entrySet())
|
for (Entry<String, JsonElement> entry : obj.getAsJsonObject("timesClaimed").entrySet())
|
||||||
playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt());
|
playerData.getItemClaims().put("profession." + entry.getKey(), entry.getValue().getAsInt());
|
||||||
|
|
||||||
if (!playerData.isStatLoaded())
|
if (!playerData.areStatsLoaded())
|
||||||
for (Profession profession : MMOCore.plugin.professionManager.getAll()) {
|
for (Profession profession : MMOCore.plugin.professionManager.getAll()) {
|
||||||
if (profession.hasExperienceTable())
|
if (profession.hasExperienceTable())
|
||||||
profession.getExperienceTable().claimStatTriggers(playerData, profession);
|
profession.getExperienceTable().claimStatTriggers(playerData, profession);
|
||||||
|
Loading…
Reference in New Issue
Block a user