forked from Upstream/mmocore
Fixed issue #828 about a bug when dying and then logging out.
This commit is contained in:
parent
59ad3259cc
commit
3f0ca4856e
@ -128,7 +128,9 @@ public class MMOCoreDataSynchronizer extends SQLDataSynchronizer<PlayerData> {
|
||||
getData().setStamina(result.getDouble("stamina"));
|
||||
getData().setStellium(result.getDouble("stellium"));
|
||||
if (getData().isOnline()) {
|
||||
health = health == 0 ? getData().getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() : health;
|
||||
//If the player is not dead and the health is 0, this means that the data was
|
||||
//missing from the data base and it gives full health to the player.
|
||||
health = health == 0 && !getData().getPlayer().isDead() ? getData().getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() : health;
|
||||
health = Math.max(Math.min(health, getData().getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()), 0);
|
||||
getData().getPlayer().setHealth(health);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user