spigot heal player code example
Example 1: spigot heal player
//Set health to maximum(20 = 10 Hearts)
player.setHealth(20);
//Add a specified amount to the current healt
if(player.getHealth() + specifiedAmount <= 20){
player.setHealth(player.getHealth + specifiedAmount);
}
Example 2: spigot heal player
if (!player.isDead()) {
try {
player.setHealth(player.getHealth()+hpToHeal);
} catch (Exception exception) { exception.printStackTrace(); }
}