Fixes max heath by using player attribute

Players may no longer have a max health of 20.

https://github.com/BentoBoxWorld/BentoBox/issues/1544
This commit is contained in:
tastybento 2020-10-11 09:11:41 -07:00
parent 5f5fe4a9c9
commit ae1db70ff6

View File

@ -3,6 +3,8 @@ package world.bentobox.bentobox.api.commands.island.team;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.attribute.Attribute;
import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand; import world.bentobox.bentobox.api.commands.ConfirmableCommand;
import world.bentobox.bentobox.api.commands.island.team.Invite.Type; import world.bentobox.bentobox.api.commands.island.team.Invite.Type;
@ -195,7 +197,8 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
// Reset the health // Reset the health
if (getIWM().isOnJoinResetHealth(getWorld())) { if (getIWM().isOnJoinResetHealth(getWorld())) {
user.getPlayer().setHealth(20.0D); double maxHealth = user.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
user.getPlayer().setHealth(maxHealth);
} }
// Reset the hunger // Reset the hunger