Java 类org.bukkit.event.entity.ExplosionPrimeEvent 实例源码

项目:Arcade2    文件:BlockTransformListeners.java   
@EventHandler(ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {
    if (event.getEntity() instanceof TNTPrimed) {
        Block block = event.getEntity().getLocation().getBlock();
        if (!block.getType().equals(Material.TNT)) {
            return;
        }

        Player player = null;
        if (event instanceof ExplosionPrimeByEntityEvent) {
            ExplosionPrimeByEntityEvent primeByEntity =
                    (ExplosionPrimeByEntityEvent) event;
            Entity entity = primeByEntity.getPrimer();

            if (entity instanceof Player) {
                player = (Player) entity;
            }
        }

        this.post(event,
                  block.getState(),
                  this.applyAir(block), player);
    }
}
项目:CraftBukkit    文件:EntityLargeFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F);
        }

        // CraftBukkit start - fire ExplosionPrimeEvent
        ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            // give 'this' instead of (Entity) null so we know what causes the damage
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing"));
        }
        // CraftBukkit end

        this.die();
    }
}
项目:CraftBukkit    文件:EntityCreeper.java   
private void ce() {
    if (!this.world.isStatic) {
        boolean flag = this.world.getGameRules().getBoolean("mobGriefing");

        // CraftBukkit start
        float radius = this.isPowered() ? 6.0F : 3.0F;

        ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
        this.world.getServer().getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
            this.die();
        } else {
            this.fuseTicks = 0;
        }
        // CraftBukkit end
    }
}
项目:AlmightyNotch    文件:CreeperExplodeEvent.java   
@Override
public void trigger(AlmightyNotchPlugin plugin, World world) {
    PluginManager pluginManager = Bukkit.getPluginManager();
    for (LivingEntity entity : world.getLivingEntities()) {
        if (entity.getType() == EntityType.CREEPER) {
            Creeper creeper = (Creeper) entity;

            float power = creeper.isPowered() ? 6.0F : 3.0F;
            ExplosionPrimeEvent event = new ExplosionPrimeEvent(creeper, power, false);
            pluginManager.callEvent(event);
            if (!event.isCancelled()) {
                creeper.damage(creeper.getHealth());
                world.createExplosion(creeper.getLocation(), power);
            }
        }
    }
    plugin.getMessenger().sendMessage(Bukkit.getServer(), getOccurMessage());
}
项目:Almura-Server    文件:EntityLargeFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F);
        }

        // CraftBukkit start
        ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            // give 'this' instead of (Entity) null so we know what causes the damage
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing"));
        }
        // CraftBukkit end

        this.die();
    }
}
项目:Creepocalypse    文件:Creepocalypse.java   
/**
 * Event handler called when an explosive is primed.
 * 
 * We use it to detect impending creeper explosions. The event is fired
 * immediately before the explosion.
 */
@EventHandler(ignoreCancelled = true)
public void onCreeperDetonate(ExplosionPrimeEvent event) {
    if (!CONFIG.isAffectedWorld(event)) {
        return;
    }

    if (event.getEntityType() == EntityType.CREEPER) {
        event.setRadius((float) CONFIG.BLAST_RADIUS_SCALE * event.getRadius());

        Entity creeper = event.getEntity();
        launchReinforcements(creeper);

        Location origin = creeper.getLocation();
        World world = origin.getWorld();
        Firework firework = (Firework) world.spawnEntity(origin, EntityType.FIREWORK);
        if (firework != null) {
            FireworkMeta meta = firework.getFireworkMeta();
            meta.setPower(random(0, 1));
            meta.addEffect(randomFireworkFffect(true));
            firework.setFireworkMeta(meta);
        }
    }
}
项目:Factoid    文件:WorldListener.java   
/**
 * On explosion prime.
 *
 * @param event the event
 */
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {

    if (event.getEntity() == null) {
        return;
    }

    Location loc = event.getEntity().getLocation();
    IDummyLand land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(loc);
    EntityType entityType = event.getEntityType();

    // Check for Explosion cancel 
    if ((entityType == EntityType.CREEPER
            && land.getFlagAndInherit(FlagList.CREEPER_EXPLOSION.getFlagType()).getValueBoolean() == false)
            || ((entityType == EntityType.PRIMED_TNT || entityType == EntityType.MINECART_TNT)
            && land.getFlagAndInherit(FlagList.TNT_EXPLOSION.getFlagType()).getValueBoolean() == false)
            || land.getFlagAndInherit(FlagList.EXPLOSION.getFlagType()).getValueBoolean() == false) {
        event.setCancelled(true);
        if (entityType == EntityType.CREEPER) {
            event.getEntity().remove();
        }
    }
}
项目:Tweakkit-Server    文件:EntityLargeFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F);
        }

        // CraftBukkit start - fire ExplosionPrimeEvent
        ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            // give 'this' instead of (Entity) null so we know what causes the damage
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing"));
        }
        // CraftBukkit end

        this.die();
    }
}
项目:Tweakkit-Server    文件:EntityCreeper.java   
private void ce() {
    if (!this.world.isStatic) {
        boolean flag = this.world.getGameRules().getBoolean("mobGriefing");

        // CraftBukkit start
        float radius = this.isPowered() ? 6.0F : 3.0F;

        ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
        this.world.getServer().getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
            this.die();
        } else {
            this.fuseTicks = 0;
        }
        // CraftBukkit end
    }
}
项目:Cauldron    文件:EntityTNTPrimed.java   
private void explode()
{
    // CraftBukkit start
    // float f = 4.0F;
    org.bukkit.craftbukkit.CraftServer server = this.worldObj.getServer();
    ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
    server.getPluginManager().callEvent(event);

    if (!event.isCancelled())
    {
        // give 'this' instead of (Entity) null so we know what causes the damage
        this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), true);
    }

    // CraftBukkit end
}
项目:Cauldron    文件:EntityLargeFireball.java   
protected void onImpact(MovingObjectPosition p_70227_1_)
{
    if (!this.worldObj.isRemote)
    {
        if (p_70227_1_.entityHit != null)
        {
            p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6.0F);
        }

        // CraftBukkit start
        ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.worldObj.getServer(), this));
        this.worldObj.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled())
        {
            // give 'this' instead of (Entity) null so we know what causes the damage
            this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
        }

        // CraftBukkit end
        this.setDead();
    }
}
项目:Cauldron    文件:EntityCreeper.java   
private void func_146077_cc()
{
    if (!this.worldObj.isRemote)
    {
        boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
        // CraftBukkit start
        float radius = this.getPowered() ? 6.0F : 3.0F;
        ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
        this.worldObj.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled())
        {
            this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, event.getRadius(), event.getFire(), flag);
            this.setDead();
        }
        else
        {
            this.timeSinceIgnited = 0;
        }

        // CraftBukkit end
    }
}
项目:McMMOPlus    文件:EntityListener.java   
/**
 * Handle ExplosionPrime events that involve modifying the event.
 *
 * @param event The event to modify
 */
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {
    Entity entity = event.getEntity();

    if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
        return;
    }

    // We can make this assumption because we (should) be the only ones using this exact metadata
    Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());

    if (!UserManager.hasPlayerDataKey(player)) {
        return;
    }

    MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();

    if (miningManager.canUseBiggerBombs()) {
        event.setRadius(miningManager.biggerBombs(event.getRadius()));
    }
}
项目:SpigotSource    文件:EntityLargeFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isClientSide) {
        if (movingobjectposition.entity != null) {
            movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F);
            this.a(this.shooter, movingobjectposition.entity);
        }

        boolean flag = this.world.getGameRules().getBoolean("mobGriefing");

        // CraftBukkit start - fire ExplosionPrimeEvent
        ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            // give 'this' instead of (Entity) null so we know what causes the damage
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
        }
        // CraftBukkit end
        this.die();
    }

}
项目:SpigotSource    文件:EntityCreeper.java   
private void dg() {
    if (!this.world.isClientSide) {
        boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
        float f = this.isPowered() ? 2.0F : 1.0F;

        // CraftBukkit start
        ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
        this.world.getServer().getPluginManager().callEvent(event);
        if (!event.isCancelled()) {
            this.aU = true;
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
            this.die();
        } else {
            fuseTicks = 0;
        }
        // CraftBukkit end
    }

}
项目:Craft-city    文件:EntityLargeFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6);
        }

        // CraftBukkit start
        ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this));
        this.world.getServer().getPluginManager().callEvent(event);

        if (!event.isCancelled()) {
            // give 'this' instead of (Entity) null so we know what causes the damage
            this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing"));
        }
        // CraftBukkit end

        this.die();
    }
}
项目:Wither    文件:WitherEventHandler.java   
@EventHandler
public void WitherExplode(ExplosionPrimeEvent  event){
    EntityType eType;
    try{
        eType = event.getEntityType();
    }catch(Exception e){
        eType = null;
    }
    if(eType != null){
        if (eType == EntityType.WITHER) {
            if (plugin.isBlockWitherExplosion()) {
                event.setCancelled(true);
                return;
            }
        }
        else if (eType == EntityType.WITHER_SKULL) {
            if (plugin.isBlockWitherExplosion()) {
                event.setCancelled(true);
                return;
            }
        }
    }

}
项目:Warzone    文件:ExplosiveListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onTNTIgnite(ExplosionPrimeEvent event) {
    if(!this.tracker.isEnabled(event.getEntity().getWorld())) return;

    if(event.getEntity() instanceof TNTPrimed) {
        TNTPrimed tnt = (TNTPrimed) event.getEntity();
        Block block = event.getEntity().getWorld().getBlockAt(event.getEntity().getLocation());
        if(block != null) {
            Player placer = this.tracker.setPlacer(block, null);
            if(placer != null) {
                this.tracker.setOwner(tnt, placer);
            }
        }
    }
}
项目:ProjectAres    文件:TNTMatchModule.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void setCustomProperties(ExplosionPrimeEvent event) {
    if(event.getEntity() instanceof TNTPrimed) {
        TNTPrimed tnt = (TNTPrimed) event.getEntity();

        if(this.properties.fuse != null) {
            tnt.setFuseTicks(this.getFuseTicks());
        }

        if(this.properties.power != null) {
            tnt.setYield(this.properties.power); // Note: not related to EntityExplodeEvent.yield
        }
    }
}
项目:ProjectAres    文件:BlockTransformListener.java   
@EventWrapper
public void onPrimeTNT(ExplosionPrimeEvent event) {
    if(event.getEntity() instanceof TNTPrimed && !(event instanceof InstantTNTPlaceEvent)) {
        Block block = event.getEntity().getLocation().getBlock();
        if(block.getType() == Material.TNT) {
            ParticipantState player;
            if(event instanceof ExplosionPrimeByEntityEvent) {
                player = entityResolver.getOwner(((ExplosionPrimeByEntityEvent) event).getPrimer());
            } else {
                player = null;
            }
            callEvent(event, block.getState(), BlockStateUtils.toAir(block), player);
        }
    }
}
项目:ProjectAres    文件:TNTTracker.java   
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPrime(ExplosionPrimeEvent event) {
    if(event.getEntity() instanceof TNTPrimed) {
        // Some TNT was activated, try to figure out why
        TNTPrimed tnt = (TNTPrimed) event.getEntity();
        TNTInfo info = null;

        if(event instanceof ExplosionPrimeByEntityEvent) {
            Entity primer = ((ExplosionPrimeByEntityEvent) event).getPrimer();
            if(primer instanceof TNTPrimed) {
                // Primed by another owned explosive, propagate the damage info (e.g. origin location)
                info = resolveEntity(primer);
            } else {
                ParticipantState owner = entities().getOwner(primer);
                if(owner != null) {
                    // Primed by some other type of owned entity e.g. flaming arrow, pet creeper, etc.
                    info = new TNTInfo(owner, tnt.getLocation());
                }
            }
        }

        if(info == null) {
            ParticipantState placer = blocks().getOwner(tnt.getLocation().getBlock());
            if(placer != null) {
                // If no primer was resolved for the event, give the TNT entity to the block placer, if any
                info = new TNTInfo(placer, tnt.getLocation());
            }
        }

        if(info != null) {
            entities().trackEntity(tnt, info);
        }
    }
}
项目:UltimateSpawn    文件:BasicFeatures.java   
@EventHandler
public void onExplode(ExplosionPrimeEvent e) {
    if (ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Explosion.Enable")) {
        if (!ConfigGServerEvent.getConfig().getBoolean("Server.Disable.Explosion.World.All_World")) {
            if (WorldUtils.getWE().contains(e.getEntity().getWorld().getName())) {
                e.setCancelled(true);
            }
        } else {
            e.setCancelled(true);
        }
    }
}
项目:AsgardAscension    文件:PlayerListener.java   
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
    event.setFire(false);
    if (event.getEntity() instanceof Fireball && event.getEntity().hasMetadata("ultimate")){
        event.setRadius(0);
    }
}
项目:Sword_Skill    文件:Other.java   
@EventHandler
    public void onExplode(ExplosionPrimeEvent event) {
       if (event.getEntity().getType()==(EntityType.PRIMED_TNT)) {
           event.setCancelled(true);
       }
       else if (event.getEntity().getType()==(EntityType.CREEPER)) {
      //なんもしねー
   }
}
项目:GamePlate    文件:TntTracker.java   
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
    if (event.getEntity().getType() == EntityType.PRIMED_TNT) {
        TNTPrimed tnt = (TNTPrimed) event.getEntity();
        Location location = event.getEntity().getLocation();

        if (tntPlaced.containsKey(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ())) {
            UUID playerUUID = tntPlaced.get(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ());
            event.getEntity().setMetadata("source", new FixedMetadataValue(GamePlate.getInstance(), playerUUID));
            tntPlaced.remove(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ());
        }
    }
}
项目:Pokkit    文件:EntityEvents.java   
@EventHandler(ignoreCancelled = false)
public void onExplosion(cn.nukkit.event.entity.ExplosionPrimeEvent event) {
    if (canIgnore(PlayerInteractEvent.getHandlerList())) {
        return;
    }

    ExplosionPrimeEvent bukkitEvent = new ExplosionPrimeEvent(PokkitEntity.toBukkit(event.getEntity()), (float) event.getForce(), true); // Always true because Nukkit doesn't have that boolean

    callCancellable(event, bukkitEvent);
}
项目:BloodMoon    文件:SuperCreepersListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onExplosionPrime(ExplosionPrimeEvent event) {
    if (event.getEntity() != null && event.getEntityType() == EntityType.CREEPER) {
        World world = event.getEntity().getWorld();
        PluginConfig worldConfig = plugin.getConfig(world);

        if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.SUPER_CREEPERS)) {
            event.setRadius((float) worldConfig.getDouble(Config.FEATURE_SUPER_CREEPERS_POWER));
            event.setFire(worldConfig.getBoolean(Config.FEATURE_SUPER_CREEPERS_FIRE));
        }
    }
}
项目:Cardinal-Plus    文件:TntTracker.java   
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
    if (event.getEntity().getType() == EntityType.PRIMED_TNT) {
        Location location = event.getEntity().getLocation();
        if (tntPlaced.containsKey(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ())) {
            UUID player = tntPlaced.get(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ());
            event.getEntity().setMetadata("source", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), player));
            tntPlaced.remove(location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ());
        }
    }
}
项目:Cardinal-Plus    文件:Tnt.java   
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
    Block block = event.getBlock();
    if (block.getType().equals(Material.TNT) && instantIgnite) {
        event.setCancelled(true);
        ItemStack tntStack = event.getPlayer().getItemInHand();
        tntStack.setAmount(tntStack.getAmount() - 1);
        event.getPlayer().setItemInHand(tntStack);
        TNTPrimed tnt = (TNTPrimed) GameHandler.getGameHandler().getMatchWorld().spawnEntity(block.getLocation().add(new Vector(0.5, 0.5, 0.5)), EntityType.PRIMED_TNT);
        tnt.setYield((float) power);
        Bukkit.getServer().getPluginManager().callEvent(new ExplosionPrimeEvent(tnt, (float) power * 10, false));
    }
}
项目:Cardinal-Plus    文件:Tnt.java   
@EventHandler
public void onExplosionPrime(ExplosionPrimeEvent event) {
    if (event.getEntity() instanceof TNTPrimed) {
        if (fuse != 4) {
            ((TNTPrimed) event.getEntity()).setFuseTicks(fuse * 20);
        }
        if (power != 4.0) {
            event.setRadius((float) power * 10);
        }
    }
}
项目:CraftBukkit    文件:EntityTNTPrimed.java   
private void explode() {
    // CraftBukkit start
    // float f = 4.0F;

    org.bukkit.craftbukkit.CraftServer server = this.world.getServer();

    ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
    server.getPluginManager().callEvent(event);

    if (!event.isCancelled()) {
        // give 'this' instead of (Entity) null so we know what causes the damage
        this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
    }
    // CraftBukkit end
}
项目:CraftBukkit    文件:EntityEnderCrystal.java   
public boolean damageEntity(DamageSource damagesource, float f) {
    if (this.isInvulnerable()) {
        return false;
    } else {
        if (!this.dead && !this.world.isStatic) {
            // CraftBukkit start - All non-living entities need this
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
                return false;
            }
            // CraftBukkit end

            this.b = 0;
            if (this.b <= 0) {
                this.die();
                if (!this.world.isStatic) {
                    // CraftBukkit start
                    ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
                    this.world.getServer().getPluginManager().callEvent(event);
                    if (event.isCancelled()) {
                        this.dead = false;
                        return false;
                    }
                    this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
                    // CraftBukkit end
                }
            }
        }

        return true;
    }
}
项目:MiniMiniGames    文件:TNTProjectile.java   
/**
 * Method added becouse of visibility of the original.
 */
private void explode() {
   CraftServer server = this.world.getServer();

   ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive) CraftEntity.getEntity(server, this));
   server.getPluginManager().callEvent(event);

   if (event.isCancelled())
      return;
   this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
}
项目:uSkyBlock    文件:GriefEvents.java   
@EventHandler
public void onCreeperExplode(ExplosionPrimeEvent event) {
    if (!creeperEnabled || !plugin.isSkyWorld(event.getEntity().getWorld())) {
        return;
    }
    if (event.getEntity() instanceof Creeper
        && !isValidTarget(((Creeper)event.getEntity()).getTarget()))
    {
        event.setCancelled(true);
    } else if (event.getEntity() instanceof TNTPrimed
        && !isValidTarget(((TNTPrimed) event.getEntity()).getSource())) {
        event.setCancelled(true);
    }
}
项目:Almura-Server    文件:EntityTNTPrimed.java   
private void explode() {
    // CraftBukkit start
    // float f = 4.0F;

    org.bukkit.craftbukkit.CraftServer server = this.world.getServer();

    ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
    server.getPluginManager().callEvent(event);

    if (!event.isCancelled()) {
        // give 'this' instead of (Entity) null so we know what causes the damage
        this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
    }
    // CraftBukkit end
}
项目:Almura-Server    文件:EntityCreeper.java   
public void l_() {
    if (this.isAlive()) {
        this.bp = this.fuseTicks;
        int i = this.bV();

        if (i > 0 && this.fuseTicks == 0) {
            this.makeSound("random.fuse", 1.0F, 0.5F);
        }

        this.fuseTicks += i;
        if (this.fuseTicks < 0) {
            this.fuseTicks = 0;
        }

        if (this.fuseTicks >= this.maxFuseTicks) {
            this.fuseTicks = this.maxFuseTicks;
            if (!this.world.isStatic) {
                boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
                // CraftBukkit start
                float radius = this.isPowered() ? 6.0F : 3.0F;

                ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
                this.world.getServer().getPluginManager().callEvent(event);
                if (!event.isCancelled()) {
                    this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag);
                    this.die();
                } else {
                    this.fuseTicks = 0;
                }
                // CraftBukkit end
            }
        }
    }

    super.l_();
}
项目:Tweakkit-Server    文件:EntityTNTPrimed.java   
private void explode() {
    // CraftBukkit start
    // float f = 4.0F;

    org.bukkit.craftbukkit.CraftServer server = this.world.getServer();

    ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this));
    server.getPluginManager().callEvent(event);

    if (!event.isCancelled()) {
        // give 'this' instead of (Entity) null so we know what causes the damage
        this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
    }
    // CraftBukkit end
}
项目:Tweakkit-Server    文件:EntityEnderCrystal.java   
public boolean damageEntity(DamageSource damagesource, float f) {
    if (this.isInvulnerable()) {
        return false;
    } else {
        if (!this.dead && !this.world.isStatic) {
            // CraftBukkit start - All non-living entities need this
            if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
                return false;
            }
            // CraftBukkit end

            this.b = 0;
            if (this.b <= 0) {
                this.die();
                if (!this.world.isStatic) {
                    // CraftBukkit start
                    ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
                    this.world.getServer().getPluginManager().callEvent(event);
                    if (event.isCancelled()) {
                        this.dead = false;
                        return false;
                    }
                    this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true);
                    // CraftBukkit end
                }
            }
        }

        return true;
    }
}
项目:ColorCube    文件:ExplosionListener.java   
@EventHandler
public void onExplosion(ExplosionPrimeEvent event){
    int id = GameManager.getInstance().getBlockGameId(event.getEntity().getLocation());
    if(id != -1){
        event.setCancelled(true);
    }
}
项目:Rixor    文件:PlayerEvents.java   
@EventHandler
public void onTNTExpload(ExplosionPrimeEvent event){
    org.bukkit.entity.Entity entity = event.getEntity();
    if (entity instanceof TNTPrimed && !Rixor.getRotation().getSlot().getMap().getTntsettings().isBlockDamage()) {
        event.setCancelled(true);
        Location explosion = event.getEntity().getLocation();
        Rixor.getMap().getWorld().createExplosion(explosion.getX(), explosion.getY(), explosion.getZ(), 2F, false, false);
        Rixor.getMap().getWorld().playSound(event.getEntity().getLocation(),Sound.EXPLODE,-4,12);
    }
}