It sucks that it's an idiot and attacking th glass to the point that it's hurting itslef. Dunno what you can do to dissuade the activity besides not having glass
If it's of any consolation, mine is an idiot like that too. Timid as hell (even the jawfish scare it off) but she always puffs up at her reflection in the glass (then runs away from it since she's a big wuss).