mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-10-30 15:30:09 +01:00
Be overly protective for creeper and enderdragon explosions.
Fixes WORLDGUARD-3522.
This commit is contained in:
parent
1c4c213ed7
commit
95bf6bc9b2
@ -32,9 +32,8 @@
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Creeper;
|
|
||||||
import org.bukkit.entity.EnderDragon;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -90,13 +89,11 @@ public void onBreakBlock(final BreakBlockEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity entity;
|
|
||||||
if ((entity = event.getCause().getFirstNonPlayerEntity()) != null) {
|
|
||||||
// ================================================================
|
// ================================================================
|
||||||
// CREEPER_EXPLOSION flag
|
// CREEPER_EXPLOSION flag
|
||||||
// ================================================================
|
// ================================================================
|
||||||
|
|
||||||
if (entity instanceof Creeper) { // Creeper
|
if (event.getCause().find(EntityType.CREEPER) != null) { // Creeper
|
||||||
event.filter(testState(query, DefaultFlag.CREEPER_EXPLOSION), config.explosionFlagCancellation);
|
event.filter(testState(query, DefaultFlag.CREEPER_EXPLOSION), config.explosionFlagCancellation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,12 +101,11 @@ public void onBreakBlock(final BreakBlockEvent event) {
|
|||||||
// ENDERDRAGON_BLOCK_DAMAGE flag
|
// ENDERDRAGON_BLOCK_DAMAGE flag
|
||||||
// ================================================================
|
// ================================================================
|
||||||
|
|
||||||
if (entity instanceof EnderDragon) { // Enderdragon
|
if (event.getCause().find(EntityType.ENDER_DRAGON) != null) { // Enderdragon
|
||||||
event.filter(testState(query, DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE), config.explosionFlagCancellation);
|
event.filter(testState(query, DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE), config.explosionFlagCancellation);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user