1//Set health to maximum(20 = 10 Hearts)
2player.setHealth(20);
3
4//Add a specified amount to the current healt
5if(player.getHealth() + specifiedAmount <= 20){
6 player.setHealth(player.getHealth + specifiedAmount);
7}
1if (!player.isDead()) {
2 try {
3 player.setHealth(player.getHealth()+hpToHeal);
4 } catch (Exception exception) { exception.printStackTrace(); }
5}