mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-03 15:08:02 +01:00
Special handling for WindCharges
This commit is contained in:
parent
6898ad8674
commit
887f3bfaec
@ -79,6 +79,7 @@
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.WindCharge;
|
||||
import org.bukkit.entity.minecart.HopperMinecart;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
@ -357,6 +358,10 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof WindCharge) {
|
||||
Events.fireBulkEventToCancel(event, new UseBlockEvent(event, create(entity), event.getLocation().getWorld(), event.blockList(), Material.AIR));
|
||||
return;
|
||||
}
|
||||
Events.fireBulkEventToCancel(event, new BreakBlockEvent(event, create(entity), event.getLocation().getWorld(), event.blockList(), Material.AIR));
|
||||
if (entity instanceof Creeper) {
|
||||
Cause.untrackParentCause(entity);
|
||||
|
@ -60,6 +60,7 @@
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.WindCharge;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.entity.Wolf;
|
||||
@ -522,6 +523,16 @@ public void onEntityExplode(EntityExplodeEvent event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ent instanceof WindCharge) {
|
||||
if (wcfg.useRegions) {
|
||||
for (Block block : event.blockList()) {
|
||||
if (!WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery().getApplicableRegions(BukkitAdapter.adapt(block.getLocation())).testState(null, Flags.WIND_CHARGE_BURST)) {
|
||||
event.blockList().clear();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// unhandled entity
|
||||
if (wcfg.blockOtherExplosions) {
|
||||
|
@ -835,6 +835,7 @@ private static void putMaterialTag(Tag<Material> tag, Integer value) {
|
||||
|
||||
MATERIAL_FLAGS.put(Material.ARMADILLO_SCUTE, 0);
|
||||
MATERIAL_FLAGS.put(Material.WOLF_ARMOR, 0);
|
||||
MATERIAL_FLAGS.put(Material.WIND_CHARGE, 0);
|
||||
|
||||
// 1.21
|
||||
MATERIAL_FLAGS.put(Material.CHISELED_TUFF, 0);
|
||||
|
@ -93,6 +93,7 @@ public final class Flags {
|
||||
public static final StateFlag ENDERDRAGON_BLOCK_DAMAGE = register(new StateFlag("enderdragon-block-damage", true));
|
||||
public static final StateFlag GHAST_FIREBALL = register(new StateFlag("ghast-fireball", true));
|
||||
public static final StateFlag OTHER_EXPLOSION = register(new StateFlag("other-explosion", true));
|
||||
public static final StateFlag WIND_CHARGE_BURST = register(new StateFlag("wind-charge-burst", true));
|
||||
public static final StateFlag WITHER_DAMAGE = register(new StateFlag("wither-damage", true));
|
||||
public static final StateFlag ENDER_BUILD = register(new StateFlag("enderman-grief", true));
|
||||
public static final StateFlag SNOWMAN_TRAILS = register(new StateFlag("snowman-trails", true));
|
||||
|
Loading…
Reference in New Issue
Block a user