There is only one solution to this, stop Hamas from using these facilities for military purposes. Same goes for schools, mosques and other public places. Once used as such, the Geneva Convention no longer recognize these paces as such but legitimate war targets. This isn’t complicated but when Israel hits such places it leaves them to be criticized for that action while leaving Hamas unmentioned for committing the war crime in the first place.