Search in sources :

Example 1 with ExplosionPrimeEvent

use of org.bukkit.event.entity.ExplosionPrimeEvent in project Glowstone by GlowstoneMC.

the class GlowTNTPrimed method explode.

private void explode() {
    ExplosionPrimeEvent event = EventFactory.callEvent(new ExplosionPrimeEvent(this));
    if (!event.isCancelled()) {
        Location location = getLocation();
        double x = location.getX() + 0.5, y = location.getY() + 0.5, z = location.getZ() + 0.5;
        world.createExplosion(this, x, y, z, event.getRadius(), event.getFire(), true);
    }
    remove();
}
Also used : ExplosionPrimeEvent(org.bukkit.event.entity.ExplosionPrimeEvent) Location(org.bukkit.Location)

Example 2 with ExplosionPrimeEvent

use of org.bukkit.event.entity.ExplosionPrimeEvent in project Glowstone by GlowstoneMC.

the class GlowTntPrimed method explode.

private void explode() {
    ExplosionPrimeEvent event = EventFactory.getInstance().callEvent(new ExplosionPrimeEvent(this));
    if (!event.isCancelled()) {
        Location location = getLocation();
        world.createExplosion(this, location.getX(), location.getY() + 0.06125, location.getZ(), event.getRadius(), event.getFire(), true);
    }
    remove();
}
Also used : ExplosionPrimeEvent(org.bukkit.event.entity.ExplosionPrimeEvent) Location(org.bukkit.Location)

Example 3 with ExplosionPrimeEvent

use of org.bukkit.event.entity.ExplosionPrimeEvent in project Glowstone by GlowstoneMC.

the class GlowEnderCrystal method damage.

@Override
public void damage(double amount, Entity source, @NotNull DamageCause cause) {
    if (source instanceof EnderDragon) {
        return;
    }
    if (cause != DamageCause.ENTITY_EXPLOSION) {
        ExplosionPrimeEvent event = EventFactory.getInstance().callEvent(new ExplosionPrimeEvent(this, Explosion.POWER_ENDER_CRYSTAL, true));
        if (!event.isCancelled()) {
            Location location = getLocation();
            double x = location.getX();
            double y = location.getY();
            double z = location.getZ();
            world.createExplosion(this, x, y, z, event.getRadius(), event.getFire(), true);
        }
    }
    remove();
}
Also used : EnderDragon(org.bukkit.entity.EnderDragon) ExplosionPrimeEvent(org.bukkit.event.entity.ExplosionPrimeEvent) Location(org.bukkit.Location)

Aggregations

Location (org.bukkit.Location)3 ExplosionPrimeEvent (org.bukkit.event.entity.ExplosionPrimeEvent)3 EnderDragon (org.bukkit.entity.EnderDragon)1