mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Cleanup & comments
This commit is contained in:
parent
45540f3782
commit
7317954d70
@ -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;
|
||||
@ -120,7 +119,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
|
||||
// NON-FINAL player data stuff made public to facilitate field change
|
||||
public boolean noCooldown;
|
||||
private boolean statLoaded;
|
||||
private final boolean statLoaded;
|
||||
public CombatRunnable combat;
|
||||
|
||||
/**
|
||||
@ -136,14 +135,13 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
questData = new PlayerQuests(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 (StatModifier modifier : instance.getModifiers())
|
||||
if (modifier.getKey().startsWith("trigger"))
|
||||
statLoaded = true;
|
||||
this.statLoaded = statLoaded;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,13 +173,12 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
}
|
||||
|
||||
public void setupSkillTree() {
|
||||
//Node states setup
|
||||
// Node states setup
|
||||
for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll())
|
||||
skillTree.setupNodeState(this);
|
||||
|
||||
|
||||
// Stat triggers setup
|
||||
if (!statLoaded)
|
||||
//Stat triggers setup
|
||||
for (SkillTree skillTree : MMOCore.plugin.skillTreeManager.getAll()) {
|
||||
for (SkillTreeNode node : skillTree.getNodes()) {
|
||||
node.getExperienceTable().claimStatTriggers(this, node);
|
||||
|
@ -1,6 +1,24 @@
|
||||
package net.Indyuce.mmocore.tree;
|
||||
|
||||
public enum NodeState {
|
||||
LOCKED,UNLOCKED,UNLOCKABLE,FULLY_LOCKED;
|
||||
/**
|
||||
* The player does not have access to this skill tree node just yet.
|
||||
*/
|
||||
LOCKED,
|
||||
|
||||
/**
|
||||
* The player has bought and unlocked the skill tree node.
|
||||
*/
|
||||
UNLOCKED,
|
||||
|
||||
/**
|
||||
* The player has access to but has not unlocked the node yet.
|
||||
*/
|
||||
UNLOCKABLE,
|
||||
|
||||
/**
|
||||
* The player had access to this node, but unlocked another
|
||||
* node which now prevents him from unlocking this one.
|
||||
*/
|
||||
FULLY_LOCKED;
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.util.PostLoadObject;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.tree.NodeState;
|
||||
import net.Indyuce.mmocore.tree.skilltree.display.DisplayInfo;
|
||||
import net.Indyuce.mmocore.manager.registry.RegisteredObject;
|
||||
import net.Indyuce.mmocore.tree.skilltree.display.Icon;
|
||||
import net.Indyuce.mmocore.tree.IntegerCoordinates;
|
||||
import net.Indyuce.mmocore.tree.NodeState;
|
||||
import net.Indyuce.mmocore.tree.SkillTreeNode;
|
||||
import net.Indyuce.mmocore.tree.skilltree.display.DisplayInfo;
|
||||
import net.Indyuce.mmocore.tree.skilltree.display.Icon;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
@ -32,7 +32,6 @@ import java.util.logging.Level;
|
||||
* - extra attribute pts
|
||||
* - particle or potion effects
|
||||
*
|
||||
* @author jules
|
||||
* @author Ka0rX
|
||||
* @see {@link SkillTreeNode}
|
||||
*/
|
||||
@ -61,7 +60,7 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
Objects.requireNonNull(config.getStringList("lore"), "Could not find skill tree lore").forEach(str -> lore.add(MythicLib.plugin.parseColors(str)));
|
||||
this.item = Material.valueOf(UtilityMethods.enumName(Objects.requireNonNull(config.getString("item"))));
|
||||
Validate.isTrue(config.isConfigurationSection("nodes"), "Could not find any nodes in the tree");
|
||||
this.maxPointSpent =config.getInt("max-point-spent",Integer.MAX_VALUE);
|
||||
this.maxPointSpent = config.getInt("max-point-spent", Integer.MAX_VALUE);
|
||||
for (String key : config.getConfigurationSection("nodes").getKeys(false)) {
|
||||
try {
|
||||
|
||||
@ -69,7 +68,7 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
nodes.put(node.getId(), node);
|
||||
|
||||
} catch (Exception e) {
|
||||
MMOCore.log( "Couldn't load skill tree node " + id + "." + key + ": " + e.getMessage());
|
||||
MMOCore.log("Couldn't load skill tree node " + id + "." + key + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
@ -86,7 +85,6 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
MMOCore.log(Level.WARNING, "Couldn't load paths for skill tree: " + id);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
//Load the icons of the skill tree.
|
||||
for (String key : config.getConfigurationSection("icons").getKeys(false)) {
|
||||
@ -102,7 +100,7 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MMOCore.log( "Couldn't load icons for the skill tree " + id);
|
||||
MMOCore.log("Couldn't load icons for the skill tree " + id);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -118,7 +116,6 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected abstract void whenPostLoaded(@NotNull ConfigurationSection configurationSection);
|
||||
|
||||
@ -178,7 +175,6 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
roots.add(node);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recursively go through the skill trees to update the the node states
|
||||
*/
|
||||
@ -187,7 +183,6 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
setupNodeStateFrom(root, playerData);
|
||||
}
|
||||
|
||||
|
||||
public List<SkillTreeNode> getRoots() {
|
||||
return roots;
|
||||
}
|
||||
@ -292,6 +287,7 @@ public abstract class SkillTree extends PostLoadObject implements RegisteredObje
|
||||
public SkillTreeNode getNode(String name) {
|
||||
return Objects.requireNonNull(nodes.get(name), "Could not find node in tree '" + id + "' with name '" + name + "'");
|
||||
}
|
||||
|
||||
public boolean isNode(String name) {
|
||||
return nodes.containsKey(name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user