The contingent spell takes effect only on you, even if it can normally target others. You can use only one contingency spell at a time. If you cast this spell again, the effect of another contingency spell on you ends. Also, contingency ends on you if its material component is ever not on your person.
Choose a spell of 5th level or lower that you can cast, that has a casting time of 1 action, and that can target you. You cast that spell, called the contingent spell, as part of casting contingency, expending spell slots for both, but the contingent spell doesn't come into effect. Instead, it takes effect when a certain circumstance occurs. You describe that circumstance when you cast the two spells. For example, a contingency cast with water breathing might stipulate that water breathing comes into effect when you are engulfed in water or a similar liquid.
The contingent spell takes effect immediately after the circumstance is met for the first time, whether or not you want it to, and then contingency ends.
A sphere of negative energy ripples out in a 60-foot-radius sphere from a point within range. Each creature in that area must make a Constitution saving throw. A target takes 8d6 necrotic damage on a failed save, or half as much damage on a successful one.
At Higher Levels: When you cast this spell using a spell slot of 7th level or higher, the damage increases by 2d6 for each slot level above 6th.
An invisible 40-foot-radius field of magic extends from you, disrupting bullets and causing firearms to malfunction. Within the sphere, attacks with firearms fail, and firearms used to make an attack immediately jam. A jammed firearm can’t be used to make an attack until a creature uses its action to clear the weapon malfunction.
Firearms outside the sphere which are fired into it have disadvantage on attack rolls, and deal only half damage on a hit.