if (!player.isDead()) {
try {
player.setHealth(player.getHealth()+hpToHeal);
} catch (Exception exception) { exception.printStackTrace(); }
}
//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);
}