int currentHP = player.getHealth();
if (currentHP < 20) {
player.setHealth(++currentHP);
// Raise an event so other plugins can keep in sync.
EntityRegainHealthEvent event = new EntityRegainHealthEvent(player, ++currentHP, RegainReason.REGEN);
Bukkit.getServer().getPluginManager().callEvent(event);
}
}