Man sentenced in hammer attack