SPARKY!!!!
This commit is contained in:
parent
35029bb33b
commit
9116d4e1c9
@ -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<Entity, Player> _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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user