Cacti hurt when hugged

 I added a method called canTakeCactusHurt. In the living entity class it always returns true because obviously animals aren't immune to cacti. In the GlowHumanEnity class I overrode the method so it returns true if the player is in survival mode or adventure mode. In the living entity class there is a method called takeCactusDamage. It gets the block the player is standing on as well as the blocks 1 up on each side. If they are cacti and the player canTakeCactiDamage() it hurts them.  In the livingEntity class I add an else clause so that if the no damage ticks aren't greater than zero they are reset so that the player can take damage again. Aaron helped me get set up and helped with the some of the logic.
Instead of adding and subtracting relative positions, use a predefined array/collection of BlockFaces and iterate those.