Permalink
Browse files

Protect entities from endercrystal explosions using explosionFlagCanc…

…ellation setting.

Should be more consistent with other explosion flags (tnt, creepers) now.
Improves fix for WORLDGUARD-2620.
  • Loading branch information...
wizjany committed Aug 24, 2016
1 parent b2b0fe6 commit 9cafb07e4d276eb75c1f460f288381fa17e2d7b3
@@ -167,6 +167,19 @@ private void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
}
}
if (attacker.getType() == Entities.enderCrystalType) {
// this isn't handled elsewhere because ender crystal explosions don't carry a player cause
// in the same way that creepers or tnt can
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(defender.getWorld());
if (wcfg.useRegions && wcfg.explosionFlagCancellation) {
if (!plugin.getRegionContainer().createQuery().getApplicableRegions(defender.getLocation())
.testState(null, DefaultFlag.OTHER_EXPLOSION)) {
event.setCancelled(true);
return;
}
}
}
if (defender instanceof Player) {
Player player = (Player) defender;
LocalPlayer localPlayer = plugin.wrapPlayer(player);

0 comments on commit 9cafb07

Please sign in to comment.