diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/ThrowableTNTModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/ThrowableTNTModule.java index 915a45edc..9b39fa7d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/ThrowableTNTModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/ThrowableTNTModule.java @@ -10,9 +10,8 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; @@ -23,11 +22,12 @@ import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemBuilder; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; public class ThrowableTNTModule extends Module { + private static final int EXPLOSION_RADIUS = 14; + private final Map _throwers; private ItemStack _tntItem; @@ -110,22 +110,22 @@ public class ThrowableTNTModule extends Module UtilAction.velocity(tntPrimed, location.getDirection(), _throwStrength, false, 0, 0.3, 1, false); player.playEffect(location, Effect.GHAST_SHOOT, 0); } + + _throwers.put(tntPrimed, player); } - @EventHandler(priority = EventPriority.LOWEST) - public void explosion(CustomDamageEvent event) + @EventHandler + public void onExplosionPrime(ExplosionPrimeEvent event) { - if (event.GetCause() != DamageCause.ENTITY_EXPLOSION) - { - return; - } + Entity entity = event.getEntity(); + Player player = _throwers.get(entity); - Entity entity = event.GetDamagerEntity(false); - Player thrower = _throwers.get(entity); - - if (thrower != null) + if (player != null) { - event.SetDamager(thrower); + for (Player other : UtilPlayer.getNearby(entity.getLocation(), EXPLOSION_RADIUS)) + { + getGame().getArcadeManager().GetCondition().Factory().Explosion("Throwing TNT", other, player, 50, 0.1, false, false); + } } } }