forked from Upstream/mmocore
Fixed on-login health issue
This commit is contained in:
parent
0fd1f6bbce
commit
13e808ba37
@ -4,6 +4,7 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.data.sql.SQLDataSource;
|
||||
import io.lumine.mythic.lib.metrics.bukkit.Metrics;
|
||||
import io.lumine.mythic.lib.util.MMOPlugin;
|
||||
import io.lumine.mythic.lib.version.SpigotPlugin;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.attribute.AttributeModifier;
|
||||
@ -54,14 +55,13 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class MMOCore extends JavaPlugin {
|
||||
public class MMOCore extends MMOPlugin {
|
||||
public static MMOCore plugin;
|
||||
public final WaypointManager waypointManager = new WaypointManager();
|
||||
public final SoundManager soundManager = new SoundManager();
|
||||
|
@ -132,7 +132,7 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
|
||||
public long lastDropEvent;
|
||||
|
||||
public PlayerData(MMOPlayerData mmoData) {
|
||||
super(mmoData);
|
||||
super(MMOCore.plugin, mmoData);
|
||||
|
||||
questData = new PlayerQuests(this);
|
||||
playerStats = new PlayerStats(this);
|
||||
@ -192,8 +192,10 @@ public class PlayerData extends SynchronizedDataHolder implements OfflinePlayerD
|
||||
* missing from the database and it gives full health to the player. If the
|
||||
* player is dead however, it must not account for that subtle edge case.
|
||||
*/
|
||||
if (isOnline() && !getPlayer().isDead())
|
||||
getPlayer().setHealth(MMOCoreUtils.fixResource(getHealth(), getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
|
||||
if (isOnline() && !getPlayer().isDead()) {
|
||||
final double effectiveHealth = Math.max(getPlayer().getHealth(), getHealth());
|
||||
getPlayer().setHealth(MMOCoreUtils.fixResource(effectiveHealth, getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
|
||||
}
|
||||
|
||||
// Finally mark synchronized
|
||||
super.markAsSynchronized();
|
||||
|
Loading…
Reference in New Issue
Block a user