diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java index 58e971da..987e8423 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/listener/EventAbstractionListener.java @@ -47,7 +47,6 @@ import com.sk89q.worldguard.bukkit.util.Materials; import com.sk89q.worldguard.config.WorldConfiguration; import com.sk89q.worldguard.protection.flags.Flags; -import com.sk89q.worldguard.protection.flags.StateFlag; import io.papermc.lib.PaperLib; import io.papermc.paper.event.player.PlayerOpenSignEvent; import org.bukkit.Bukkit; @@ -68,8 +67,8 @@ import org.bukkit.block.data.BlockData; import org.bukkit.block.data.Waterlogged; import org.bukkit.block.data.type.Dispenser; -import org.bukkit.entity.AbstractWindCharge; import org.bukkit.entity.AreaEffectCloud; +import org.bukkit.entity.BreezeWindCharge; import org.bukkit.entity.Creeper; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -83,6 +82,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; @@ -328,10 +328,10 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) { // Fire two events: one as BREAK and one as PLACE if (toType != Material.AIR && fromType != Material.AIR) { - BreakBlockEvent breakDelagate = new BreakBlockEvent(event, cause, block); - setDelegateEventMaterialOptions(breakDelagate, fromType, toType); + BreakBlockEvent breakDelegate = new BreakBlockEvent(event, cause, block); + setDelegateEventMaterialOptions(breakDelegate, fromType, toType); boolean denied; - if (!(denied = Events.fireToCancel(event, breakDelagate))) { + if (!(denied = Events.fireToCancel(event, breakDelegate))) { PlaceBlockEvent placeDelegate = new PlaceBlockEvent(event, cause, block.getLocation(), toType); setDelegateEventMaterialOptions(placeDelegate, fromType, toType); denied = Events.fireToCancel(event, placeDelegate); @@ -364,7 +364,9 @@ public void onEntityKnockbackByEntity(EntityKnockbackByEntityEvent event) { Entity damager = event.getSourceEntity(); final DamageEntityEvent eventToFire = new DamageEntityEvent(event, create(damager), event.getEntity()); - if (damager instanceof AbstractWindCharge) { + if (damager instanceof BreezeWindCharge) { + eventToFire.getRelevantFlags().add(Flags.BREEZE_WIND_CHARGE); + } else if (damager instanceof WindCharge) { eventToFire.getRelevantFlags().add(Flags.WIND_CHARGE_BURST); } Events.fireToCancel(event, eventToFire); diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java index 205d0b64..c66cefe5 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Entities.java @@ -21,11 +21,11 @@ import com.sk89q.worldguard.protection.flags.Flags; import com.sk89q.worldguard.protection.flags.StateFlag; -import org.bukkit.entity.AbstractWindCharge; import org.bukkit.entity.Allay; import org.bukkit.entity.Ambient; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Arrow; +import org.bukkit.entity.BreezeWindCharge; import org.bukkit.entity.Creature; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EnderDragon; @@ -48,6 +48,7 @@ import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.Tameable; import org.bukkit.entity.Vehicle; +import org.bukkit.entity.WindCharge; import org.bukkit.entity.Wither; import org.bukkit.entity.minecart.ExplosiveMinecart; import org.bukkit.event.entity.CreatureSpawnEvent; @@ -260,7 +261,8 @@ public static boolean isPluginSpawning(CreatureSpawnEvent.SpawnReason spawnReaso */ public static @Nonnull StateFlag getExplosionFlag(Entity entity) { return switch (entity) { - case AbstractWindCharge abstractWindCharge -> Flags.WIND_CHARGE_BURST; + case BreezeWindCharge breezeWindCharge -> Flags.BREEZE_WIND_CHARGE; + case WindCharge windCharge -> Flags.WIND_CHARGE_BURST; case Firework firework -> Flags.FIREWORK_DAMAGE; case Fireball fireball -> Flags.GHAST_FIREBALL; case Wither wither -> Flags.WITHER_DAMAGE; diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java index 28032158..ea0e2f04 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/util/Materials.java @@ -22,7 +22,6 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.sk89q.worldguard.protection.flags.Flags; -import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.entity.EntityType; diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java b/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java index 5702cfe1..6b7c2063 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags/Flags.java @@ -74,6 +74,7 @@ public final class Flags { public static final StateFlag FIREWORK_DAMAGE = register(new StateFlag("firework-damage", false)); public static final StateFlag USE_ANVIL = register(new StateFlag("use-anvil", false)); public static final StateFlag USE_DRIPLEAF = register(new StateFlag("use-dripleaf", false)); + public static final StateFlag WIND_CHARGE_BURST = register(new StateFlag("wind-charge-burst", false)); // These flags are similar to the ones above (used in tandem with BUILD), // but their defaults are set to TRUE because it is more user friendly. @@ -93,7 +94,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 BREEZE_WIND_CHARGE = register(new StateFlag("breeze-charge-explosion", 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));