The example you gave at event.setFire(false)
is used in Event inside the Spigot API (Plugin programming). This solution is more eligible in terms of Vanilla.
First, create two dummy
-type scoreboard objectives. For this example, let's call them "A" and "C":
scoreboard objectives add A dummy
scoreboard objectives add C dummy
On a 20 Hz clock, run these commands in this order:
execute @e[score_A_min=0,type=FireBall] ~ ~ ~ summon ArmorStand ~ ~ ~ {DisplayName:"B", DisplayNameVisible:false}
scoreboard players set @e[type=FireBall,score_A=0] A 1
tp @e[type=ArmorStand,name=B,c=1] @e[score_A_min=1]
execute @e[type=FireBall] ~ ~ ~ scoreboard players set @e[type=ArmorStand,name=B,c=1,r=0] C 1
execute @e[type=ArmorStand,name=B,score_C=0] ~ ~ ~ fill ~-6 ~-6 ~-6 ~6 ~6 ~6 air 0 replace fire
kill @e[type=ArmorStand,name=B,score_C=0]
scoreboard players set @e[type=ArmorStand,name=B] C 0
To track down the FireBall's location, we summon an ArmorStand with no HitBox, and set his name to anything. For this answer, we'll call it "B" (Name will not be shown). After the summon, we set the FireBall's A score to 1, and will teleport the ArmorStand to it every tick.
Execute as the FireBall to set the closest ArmorStand's C score to 1.
Let's make any ArmorStand with 0 score of C to transform nearby fire to air, since that would mean that the FireBall is dead (exploded). Aftward, we kill the ArmorStand. In order to that work, we also will have to set all the ArmorStands to 0 at the end.
You should run the following command before the /effect
command, to make all entities with the tag "Detector" give all players within a radius of 10 a tooClose score of 1:
/execute @e[tag=Detector] ~ ~ ~ /scoreboard players set @a[r=10,rm=1] tooClose 1
And then reset the score after the /effect
command has been run:
/scoreboard players set @a[score_tooClose_min=1] tooClose 0
You can replace r=10
with your detection radius, and tag=Detector
with however you're identifying the mobs you are wanting to detect the player, or keep the tag and do something like to add the tag to mobs:
/scoreboard players tag @e[type=Zombie] add Detector
Best Answer
Lightning, regardless of whether or not you are standing in fire, will often hit an entity twice in a row. You can see this by standing in water and summoning a bunch of LightningBolts and watching your health.
To get around this, you could give the player a high level of resistance 1 tick after the lightning strikes so that they take no damage from the second hit (if it occurs). For example:
A 1 tick delay so the first hit counts, and then: