forked from Upstream/mmocore
Fixed an on-login issue with non-vanilla resources
This commit is contained in:
parent
79d763718d
commit
8a8ec67f14
@ -1219,7 +1219,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
|
|||||||
updateTemporaryTriggers();
|
updateTemporaryTriggers();
|
||||||
|
|
||||||
// Update stats
|
// Update stats
|
||||||
if (isOnline() && isSynchronized()) getStats().updateStats();
|
if (isOnline()) getStats().updateStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSkillBound(int slot) {
|
public boolean hasSkillBound(int slot) {
|
||||||
|
@ -12,16 +12,6 @@ import java.util.*;
|
|||||||
|
|
||||||
public class StatManager implements MMOCoreManager {
|
public class StatManager implements MMOCoreManager {
|
||||||
private final Map<String, StatInfo> loaded = new HashMap<>();
|
private final Map<String, StatInfo> loaded = new HashMap<>();
|
||||||
|
|
||||||
/**
|
|
||||||
* Keeps track of all the item stats used so far in the plugin.
|
|
||||||
* It is not a constant since users can freely add or even create
|
|
||||||
* new stats.
|
|
||||||
* <p>
|
|
||||||
* These stats appear at least once:
|
|
||||||
* - in a class definition
|
|
||||||
* - in stats.yml which defines default stat formulas
|
|
||||||
*/
|
|
||||||
private final Set<String> usedStats = new HashSet<>();
|
private final Set<String> usedStats = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -44,7 +34,7 @@ public class StatManager implements MMOCoreManager {
|
|||||||
/**
|
/**
|
||||||
* Keeps track of all the item stats used so far in the plugin.
|
* Keeps track of all the item stats used so far in the plugin.
|
||||||
* It is not a constant since users can freely add or even create
|
* It is not a constant since users can freely add or even create
|
||||||
* new stats.
|
* new stats. But this is a working approximation for MMOCore only.
|
||||||
* <p>
|
* <p>
|
||||||
* These stats appear at least once:
|
* These stats appear at least once:
|
||||||
* - in a class definition
|
* - in a class definition
|
||||||
@ -53,6 +43,7 @@ public class StatManager implements MMOCoreManager {
|
|||||||
* @return A list of stats that must be taken into account in MMOCore
|
* @return A list of stats that must be taken into account in MMOCore
|
||||||
* in the player stat calculation.
|
* in the player stat calculation.
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public Set<String> getRegistered() {
|
public Set<String> getRegistered() {
|
||||||
return usedStats;
|
return usedStats;
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,11 @@ import net.Indyuce.mmocore.MMOCore;
|
|||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||||
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
||||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
|
||||||
import net.Indyuce.mmocore.guild.provided.Guild;
|
import net.Indyuce.mmocore.guild.provided.Guild;
|
||||||
import net.Indyuce.mmocore.manager.data.OfflinePlayerData;
|
import net.Indyuce.mmocore.manager.data.OfflinePlayerData;
|
||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
import net.Indyuce.mmocore.skilltree.SkillTreeNode;
|
import net.Indyuce.mmocore.skilltree.SkillTreeNode;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -101,7 +99,6 @@ public class YAMLPlayerDataHandler extends YAMLSynchronizedDataHandler<PlayerDat
|
|||||||
if (section1 != null)
|
if (section1 != null)
|
||||||
for (String key2 : config.getConfigurationSection("times-claimed." + key + "." + key1).getKeys(false)) {
|
for (String key2 : config.getConfigurationSection("times-claimed." + key + "." + key1).getKeys(false)) {
|
||||||
data.getItemClaims().put(key + "." + key1 + "." + key2, config.getInt("times-claimed." + key + "." + key1 + "." + key2));
|
data.getItemClaims().put(key + "." + key1 + "." + key2, config.getInt("times-claimed." + key + "." + key1 + "." + key2));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,9 +124,9 @@ public class YAMLPlayerDataHandler extends YAMLSynchronizedDataHandler<PlayerDat
|
|||||||
* MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded.
|
* MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded.
|
||||||
*/
|
*/
|
||||||
data.setHealth(config.getDouble("health"));
|
data.setHealth(config.getDouble("health"));
|
||||||
data.setMana(config.contains("mana") ? config.getDouble("mana") : data.getStats().getStat("MAX_MANA"));
|
data.setMana(config.getDouble("mana", data.getStats().getStat("MAX_MANA")));
|
||||||
data.setStamina(config.contains("stamina") ? config.getDouble("stamina") : data.getStats().getStat("MAX_STAMINA"));
|
data.setStamina(config.getDouble("stamina", data.getStats().getStat("MAX_STAMINA")));
|
||||||
data.setStellium(config.contains("stellium") ? config.getDouble("stellium") : data.getStats().getStat("MAX_STELLIUM"));
|
data.setStellium(config.getDouble("stellium", data.getStats().getStat("MAX_STELLIUM")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user