mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-22 17:17:57 +01:00
Fix wind-charge-burst flag for player knockback
This commit is contained in:
parent
afb619d2ac
commit
9dd7d7c03e
@ -68,6 +68,7 @@
|
||||
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.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -117,6 +118,7 @@
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityInteractEvent;
|
||||
import org.bukkit.event.entity.EntityKnockbackByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
@ -357,6 +359,17 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityKnockbackByEntity(EntityKnockbackByEntityEvent event) {
|
||||
Entity damager = event.getSourceEntity();
|
||||
|
||||
final DamageEntityEvent eventToFire = new DamageEntityEvent(event, create(damager), event.getEntity());
|
||||
if (damager instanceof AbstractWindCharge) {
|
||||
eventToFire.getRelevantFlags().add(Flags.WIND_CHARGE_BURST);
|
||||
}
|
||||
Events.fireToCancel(event, eventToFire);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
@ -330,7 +330,6 @@ private void onEntityDamageByProjectile(EntityDamageByEntityEvent event) {
|
||||
}
|
||||
}
|
||||
if (wcfg.useRegions) {
|
||||
WorldGuardPlugin.inst().getLogger().info("Getting damager type " + event.getDamager().getType());
|
||||
RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();
|
||||
if (!query.testState(localPlayer.getLocation(), localPlayer, Entities.getExplosionFlag(event.getDamager())) && wcfg.explosionFlagCancellation) {
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user