Fixed the bug where player die when joining server.

This commit is contained in:
Ka0rX 2023-04-02 23:09:37 +01:00
parent 395844c25a
commit c31a3fcec1

View File

@ -121,8 +121,9 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
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"));
double health=config.contains("health") ? config.getDouble("health") : data.getStats().getStat("MAX_HEALTH");
health=Math.min(health,data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
double health = config.contains("health") ? config.getDouble("health") : data.getStats().getStat("MAX_HEALTH");
health = health == 0 ? 20 : health;
health = Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
data.getPlayer().setHealth(health);
data.setFullyLoaded();
}
@ -148,7 +149,7 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
data.mapSkillTreePoints().forEach((key1, value) -> config.set("skill-tree-points." + key1, value));
config.set("skill-tree-reallocation-points", data.getSkillTreeReallocationPoints());
config.set("skill", null);
config.set("health",data.getHealth());
config.set("health", data.getHealth());
config.set("mana", data.getMana());
config.set("stellium", data.getStellium());
config.set("stamina", data.getStamina());