Enderman attacks a player if he's looking at him.

It works and they don't attack if he has a pumpkin on his head :)
Code says, if light is lower or equal to seven, don't attack.

Comment clarifies that they only attack when light is higher than seven.

Am I missing something important :(