From 8a8ec67f145a2cff1e561d45e515d08e7390ce8d Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 29 Mar 2024 00:47:03 +0100 Subject: [PATCH] Fixed an on-login issue with non-vanilla resources --- .../net/Indyuce/mmocore/api/player/PlayerData.java | 2 +- .../net/Indyuce/mmocore/manager/StatManager.java | 13 ++----------- .../manager/data/yaml/YAMLPlayerDataHandler.java | 9 +++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java index 38ea91e9..7eb46f5c 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/api/player/PlayerData.java @@ -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) { diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/StatManager.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/StatManager.java index 041634d0..29025e19 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/StatManager.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/StatManager.java @@ -12,16 +12,6 @@ import java.util.*; public class StatManager implements MMOCoreManager { private final Map 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. - *

- * These stats appear at least once: - * - in a class definition - * - in stats.yml which defines default stat formulas - */ private final Set 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. *

* 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 getRegistered() { return usedStats; } diff --git a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java index a1c82e27..601a4448 100644 --- a/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java +++ b/MMOCore-API/src/main/java/net/Indyuce/mmocore/manager/data/yaml/YAMLPlayerDataHandler.java @@ -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