forked from Upstream/mmocore
Fixed Multiple Servers Skill Tree Bug
This commit is contained in:
parent
57fe9f1f1b
commit
ae9c396c25
@ -183,11 +183,11 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
skillTree.setupNodeStates(this);
|
skillTree.setupNodeStates(this);
|
||||||
|
|
||||||
// Stat triggers setup
|
// Stat triggers setup
|
||||||
if (!areStatsLoaded()) {
|
|
||||||
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);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPointSpent(SkillTree skillTree) {
|
public int getPointSpent(SkillTree skillTree) {
|
||||||
@ -232,15 +232,18 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
return nodeLevelsString.entrySet();
|
return nodeLevelsString.entrySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean areStatsLoaded() {
|
public void resetTriggerStats() {
|
||||||
// Used to see if the triggers need to be applied
|
for (StatInstance instance : mmoData.getStatMap().getInstances()) {
|
||||||
for (StatInstance instance : mmoData.getStatMap().getInstances())
|
Iterator<StatModifier> iter = instance.getModifiers().iterator();
|
||||||
for (StatModifier modifier : instance.getModifiers())
|
while (iter.hasNext()) {
|
||||||
|
StatModifier modifier = iter.next();
|
||||||
if (modifier.getKey().startsWith(StatTrigger.TRIGGER_PREFIX))
|
if (modifier.getKey().startsWith(StatTrigger.TRIGGER_PREFIX))
|
||||||
return true;
|
modifier.unregister(mmoData);
|
||||||
return false;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<SkillTreeNode, Integer> getNodeLevels() {
|
public Map<SkillTreeNode, Integer> getNodeLevels() {
|
||||||
return new HashMap<>(nodeLevels);
|
return new HashMap<>(nodeLevels);
|
||||||
}
|
}
|
||||||
@ -748,9 +751,9 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
final double r = Math.sin((double) t / warpTime * Math.PI);
|
final double r = Math.sin((double) t / warpTime * Math.PI);
|
||||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4)
|
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4)
|
||||||
getPlayer().getLocation().getWorld().spawnParticle(Particle.REDSTONE, getPlayer().getLocation().add(
|
getPlayer().getLocation().getWorld().spawnParticle(Particle.REDSTONE, getPlayer().getLocation().add(
|
||||||
Math.cos((double) 5 * t / warpTime + j) * r,
|
Math.cos((double) 5 * t / warpTime + j) * r,
|
||||||
(double) 2 * t / warpTime,
|
(double) 2 * t / warpTime,
|
||||||
Math.sin((double) 5 * t / warpTime + j) * r),
|
Math.sin((double) 5 * t / warpTime + j) * r),
|
||||||
1, new Particle.DustOptions(Color.PURPLE, 1.25f));
|
1, new Particle.DustOptions(Color.PURPLE, 1.25f));
|
||||||
}
|
}
|
||||||
}.runTaskTimer(MMOCore.plugin, 0, 1);
|
}.runTaskTimer(MMOCore.plugin, 0, 1);
|
||||||
@ -1199,7 +1202,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
* checks if they could potentially upgrade to one of these
|
* checks if they could potentially upgrade to one of these
|
||||||
*
|
*
|
||||||
* @return If the player can change its current class to
|
* @return If the player can change its current class to
|
||||||
* a subclass
|
* a subclass
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean canChooseSubclass() {
|
public boolean canChooseSubclass() {
|
||||||
|
@ -101,15 +101,12 @@ 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.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);
|
|
||||||
}
|
|
||||||
if (playerData.getProfess().hasExperienceTable())
|
|
||||||
playerData.getProfess().getExperienceTable().claimStatTriggers(playerData, playerData.getProfess());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (playerData.getProfess().hasExperienceTable())
|
||||||
|
playerData.getProfess().getExperienceTable().claimStatTriggers(playerData, playerData.getProfess());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadData(ResultSet result) throws SQLException {
|
public void loadData(ResultSet result) throws SQLException {
|
||||||
|
//Reset stats linked to triggers
|
||||||
|
data.resetTriggerStats();
|
||||||
|
|
||||||
|
|
||||||
// Initialize custom resources
|
// Initialize custom resources
|
||||||
data.setMana(result.getFloat("mana"));
|
data.setMana(result.getFloat("mana"));
|
||||||
|
@ -33,6 +33,9 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
|||||||
public void loadData(PlayerData data) {
|
public void loadData(PlayerData data) {
|
||||||
FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig();
|
FileConfiguration config = new ConfigFile(data.getUniqueId()).getConfig();
|
||||||
|
|
||||||
|
//Reset stats linked to triggers.
|
||||||
|
data.resetTriggerStats();
|
||||||
|
|
||||||
data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints()));
|
data.setClassPoints(config.getInt("class-points", getDefaultData().getClassPoints()));
|
||||||
data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints()));
|
data.setSkillPoints(config.getInt("skill-points", getDefaultData().getSkillPoints()));
|
||||||
data.setSkillReallocationPoints(config.getInt("skill-reallocation-points", getDefaultData().getSkillReallocationPoints()));
|
data.setSkillReallocationPoints(config.getInt("skill-reallocation-points", getDefaultData().getSkillReallocationPoints()));
|
||||||
|
Loading…
Reference in New Issue
Block a user