Check out example codes for "spigot heal player". It will help you in understanding the concepts better.

Code Example 1

if (!player.isDead()) {
	try {
		player.setHealth(player.getHealth()+hpToHeal);
	} catch (Exception exception) { exception.printStackTrace(); }
}

Learn ReactJs, React Native from akashmittal.com