mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-26 12:35:23 +01:00
Protect entities from endercrystal explosions using explosionFlagCancellation setting.
Should be more consistent with other explosion flags (tnt, creepers) now. Improves fix for WORLDGUARD-2620.
This commit is contained in:
parent
b2b0fe65c6
commit
9cafb07e4d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user