mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-27 00:45:40 +01:00
Fixed data sync health issue
This commit is contained in:
parent
588665f0b7
commit
8b5a94bf3a
@ -118,16 +118,18 @@ public class MMOCoreDataSynchronizer extends DataSynchronizer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//These should be loaded after to make sure that the MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded.
|
/*
|
||||||
|
* These should be loaded after to make sure that the
|
||||||
|
* MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded.
|
||||||
|
*/
|
||||||
data.setMana(result.getDouble("mana"));
|
data.setMana(result.getDouble("mana"));
|
||||||
data.setStamina(result.getDouble("stamina"));
|
data.setStamina(result.getDouble("stamina"));
|
||||||
data.setStellium(result.getDouble("stamina"));
|
data.setStellium(result.getDouble("stamina"));
|
||||||
double health = result.getDouble("health");
|
double health = result.getDouble("health");
|
||||||
health = health == 0 ? 20 : health;
|
health = health == 0 ? data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() : health;
|
||||||
health = Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
health = Math.max(Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()), 0);
|
||||||
data.getPlayer().setHealth(health);
|
data.getPlayer().setHealth(health);
|
||||||
|
|
||||||
|
|
||||||
UtilityMethods.debug(MMOCore.plugin, "SQL", String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel()));
|
UtilityMethods.debug(MMOCore.plugin, "SQL", String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel()));
|
||||||
data.setFullyLoaded();
|
data.setFullyLoaded();
|
||||||
}
|
}
|
||||||
|
@ -116,14 +116,18 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
|||||||
MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage());
|
MMOCore.log(Level.WARNING, "Could not load class info '" + key + "': " + exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
//These should be loaded after to make sure that the MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded.
|
* These should be loaded after to make sure that the
|
||||||
|
* MAX_MANA, MAX_STAMINA & MAX_STELLIUM stats are already loaded.
|
||||||
|
*/
|
||||||
data.setMana(config.contains("mana") ? config.getDouble("mana") : data.getStats().getStat("MAX_MANA"));
|
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.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.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");
|
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());
|
health = health == 0 ? data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() : health;
|
||||||
|
health = Math.max(Math.min(health, data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()), 0);
|
||||||
data.getPlayer().setHealth(health);
|
data.getPlayer().setHealth(health);
|
||||||
|
|
||||||
data.setFullyLoaded();
|
data.setFullyLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user