mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-03-01 15:51:06 +01:00
Fixed /mmocore admin exportdata
This commit is contained in:
parent
c94795fc89
commit
2a4e509a8b
@ -374,6 +374,8 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
@Override
|
||||
public void close() {
|
||||
|
||||
health = getPlayer().getHealth();
|
||||
|
||||
// Close combat handler
|
||||
combat.close();
|
||||
|
||||
|
@ -45,13 +45,13 @@ public abstract class PlayerDataManager {
|
||||
*/
|
||||
public void unregisterSafe(PlayerData playerData) {
|
||||
|
||||
// Save data async if required
|
||||
if (playerData.isFullyLoaded())
|
||||
Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> saveData(playerData, true));
|
||||
|
||||
// Close and unregister data instantly if no error occured
|
||||
playerData.close();
|
||||
data.remove(playerData.getUniqueId());
|
||||
|
||||
// Save data async if required
|
||||
if (playerData.isFullyLoaded())
|
||||
Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> saveData(playerData, true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,13 +122,17 @@ 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.
|
||||
*/
|
||||
data.setHealth(result.getDouble("health"));
|
||||
data.setMana(result.getDouble("mana"));
|
||||
data.setStamina(result.getDouble("stamina"));
|
||||
data.setStellium(result.getDouble("stellium"));
|
||||
double health = result.getDouble("health");
|
||||
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);
|
||||
|
||||
if (data.isOnline()) {
|
||||
double health = data.getHealth();
|
||||
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);
|
||||
}
|
||||
|
||||
UtilityMethods.debug(MMOCore.plugin, "SQL", String.format("{ class: %s, level: %d }", data.getProfess().getId(), data.getLevel()));
|
||||
data.setFullyLoaded();
|
||||
|
@ -120,13 +120,17 @@ public class YAMLPlayerDataManager extends PlayerDataManager {
|
||||
* These should be loaded after to make sure that the
|
||||
* 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"));
|
||||
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);
|
||||
|
||||
if (data.isOnline()) {
|
||||
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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user