Skip to content
Permalink
Browse files

Check creeper-explosion flag for all entity damage, not just players.

  • Loading branch information...
wizjany committed Sep 26, 2019
1 parent 1c3cf02 commit cb9ab3a7b2c42ecdf28213eb8015f929902b4a12
@@ -64,6 +64,7 @@
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
@@ -788,6 +789,8 @@ public void onEntityDamage(EntityDamageEvent event) {
final DamageEntityEvent eventToFire = new DamageEntityEvent(event, create(damager), event.getEntity());
if (damager instanceof Firework) {
eventToFire.getRelevantFlags().add(Flags.FIREWORK_DAMAGE);
} else if (damager instanceof Creeper) {
eventToFire.getRelevantFlags().add(Flags.CREEPER_EXPLOSION);
}
Events.fireToCancel(event, eventToFire);

@@ -282,13 +282,6 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
event.setCancelled(true);
return;
}

if (attacker instanceof Creeper) {
if (!set.testState(localPlayer, Flags.CREEPER_EXPLOSION) && wcfg.explosionFlagCancellation) {
event.setCancelled(true);
return;
}
}
}
}
}

0 comments on commit cb9ab3a

Please sign in to comment.
You can’t perform that action at this time.