The mayor and council shall have the power to fix and establish fire limits and from time to time to extend, enlarge, or restrict same; to prescribe fire safety regulations not inconsistent with general law, relating to both fire prevention and detection and to fire fighting; and to prescribe penalties and punishment for violation thereof; also the mayor and council shall have the power to regulate the erection and construction of buildings and all other structures, including but not limited to adoption of building, housing, plumbing, electrical, gas, energy, and heating and air-conditioning codes, and to provide by ordinance penalties for any violation of the same.