Fixed an on-login issue with non-vanilla resources

This commit is contained in:
Jules 2024-03-29 00:47:03 +01:00
parent 79d763718d
commit 8a8ec67f14
3 changed files with 6 additions and 18 deletions

View File

@ -1219,7 +1219,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
updateTemporaryTriggers();
// Update stats
if (isOnline() && isSynchronized()) getStats().updateStats();
if (isOnline()) getStats().updateStats();
}
public boolean hasSkillBound(int slot) {

View File

@ -12,16 +12,6 @@ import java.util.*;
public class StatManager implements MMOCoreManager {
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<>();
@Override
@ -44,7 +34,7 @@ public class StatManager implements MMOCoreManager {
/**
* 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.
* new stats. But this is a working approximation for MMOCore only.
* <p>
* These stats appear at least once:
* - 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
* in the player stat calculation.
*/
@NotNull
public Set<String> getRegistered() {
return usedStats;
}

View File

@ -5,13 +5,11 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
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.manager.data.OfflinePlayerData;
import net.Indyuce.mmocore.skill.ClassSkill;
import net.Indyuce.mmocore.skilltree.SkillTreeNode;
import org.apache.commons.lang.Validate;
import org.bukkit.attribute.Attribute;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@ -101,7 +99,6 @@ public class YAMLPlayerDataHandler extends YAMLSynchronizedDataHandler<PlayerDat
if (section1 != null)
for (String key2 : config.getConfigurationSection("times-claimed." + key + "." + key1).getKeys(false)) {
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.
*/
data.setHealth(config.getDouble("health"));
data.setMana(config.contains("mana") ? config.getDouble("mana") : data.getStats().getStat("MAX_MANA"));
data.setStamina(config.contains("stamina") ? config.getDouble("stamina") : data.getStats().getStat("MAX_STAMINA"));
data.setStellium(config.contains("stellium") ? config.getDouble("stellium") : data.getStats().getStat("MAX_STELLIUM"));
data.setMana(config.getDouble("mana", data.getStats().getStat("MAX_MANA")));
data.setStamina(config.getDouble("stamina", data.getStats().getStat("MAX_STAMINA")));
data.setStellium(config.getDouble("stellium", data.getStats().getStat("MAX_STELLIUM")));
}
@Override