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

项目:Skript    文件:EffIgnite.java   
@Override
protected void execute(final Event e) {
    final int d;
    if (duration != null) {
        final Timespan t = duration.getSingle(e);
        if (t == null)
            return;
        d = (int) (t.getTicks_i() >= Integer.MAX_VALUE ? Integer.MAX_VALUE : t.getTicks_i());
    } else {
        d = ignite ? DEFAULT_DURATION : 0;
    }
    for (final Entity en : entities.getArray(e)) {
        if (e instanceof EntityDamageEvent && ((EntityDamageEvent) e).getEntity() == en && !Delay.isDelayed(e)) {
            Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
                @Override
                public void run() {
                    en.setFireTicks(d);
                }
            });
        } else {
            if (e instanceof EntityCombustEvent && ((EntityCombustEvent) e).getEntity() == en && !Delay.isDelayed(e))
                ((EntityCombustEvent) e).setCancelled(true);// can't change the duration, thus simply cancel the event (and create a new one)
            en.setFireTicks(d);
        }
    }
}
项目:Pokkit    文件:EntityEvents.java   
@EventHandler(ignoreCancelled = false)
public void onEntityCombust(cn.nukkit.event.entity.EntityCombustEvent event) {
    if (canIgnore(EntityCombustEvent.getHandlerList())) {
        return;
    }

    // EntityCombustEvent and EntityCombustBy*Event share their handler
    // lists. So this method can also be called with the event parameter set
    // to an EntityCombustByEntityEvent or EntityCombustByBlockEvent. In that
    // case, the event translation is a bit more involved.
    if (event instanceof cn.nukkit.event.entity.EntityCombustByEntityEvent) {
        onEntityCombustByEntity((cn.nukkit.event.entity.EntityCombustByEntityEvent) event);
        return;
    }
    if (event instanceof cn.nukkit.event.entity.EntityCombustByBlockEvent) {
        onEntityCombustByBlock((cn.nukkit.event.entity.EntityCombustByBlockEvent) event);
        return;
    }

    EntityCombustEvent bukkitEvent = new EntityCombustEvent(PokkitEntity.toBukkit(event.getEntity()), event.getDuration());

    callCancellable(event, bukkitEvent);
    event.setDuration(bukkitEvent.getDuration());
}
项目:SwornCritters    文件:EntityListener.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityCombust(EntityCombustEvent event)
{
    if (stopSunlightCombustion)
    {
        EntityType type = event.getEntityType();
        if (type == EntityType.SKELETON || type == EntityType.ZOMBIE)
        {
            World world = event.getEntity().getWorld();
            if (world.getTime() <= 13500L)
            {
                event.setCancelled(true);
            }
        }
    }
}
项目:ProjectAres    文件:EventFilterMatchModule.java   
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onCombust(final EntityCombustEvent event) {
    cancelUnlessInteracting(event, event.getEntity());
    if(event instanceof EntityCombustByEntityEvent) {
        cancelUnlessInteracting(event, ((EntityCombustByEntityEvent) event).getCombuster());
    }
}
项目:Sunscreen    文件:CombustionListener.java   
/**
 * Triggers when something combusts in the world.
 * 
 * @param event
 *            The event being fired.
 * @author HomieDion
 * @since 1.1.0
 */
@EventHandler(ignoreCancelled = true)
public void onCombust(final EntityCombustEvent event) {
    // Ignore if this is caused by an event lower down the chain.
    if (event instanceof EntityCombustByEntityEvent || event instanceof EntityCombustByBlockEvent) {
        return;
    }

    // Variables
    final EntityType type = event.getEntityType();
    final World world = event.getEntity().getWorld();

    // Ignore world's without sunlight
    if (world.getEnvironment() != Environment.NORMAL) {
        return;
    }

    // Ignore disabled worlds
    if (settings.isDisabledWorld(world)) {
        return;
    }

    // Ignore someone without sunscreen
    if (!settings.hasSunscreen(type)) {
        return;
    }

    // Prevent the target from burning.
    event.setCancelled(true);
}
项目:MT_Core    文件:MobListener.java   
@EventHandler
public void onBurn(EntityCombustEvent e) {
    if (e.getEntityType() == EntityType.ZOMBIE) {
        long time = e.getEntity().getWorld().getTime();
        if (e.getEntity().getLocation().getBlock().getLightFromSky() == 15 && time > 0 && time < 12000) {
            e.getEntity().setFireTicks(0);
            e.setDuration(0);
            e.setCancelled(true);
        }
    }
}
项目:SimpleFreeze    文件:EntityCombustListener.java   
@EventHandler
public void onEntityCombust(EntityCombustEvent e) {
    if (e.getEntity() instanceof Player) {
        if (this.playerManager.isFrozen(e.getEntity().getUniqueId())) {
            if (!this.plugin.getConfig().getBoolean("fire-damage")) {
                e.setCancelled(true);
            }
        }
    }
}
项目:ExilePearl    文件:PlayerListener.java   
/**
 * Free the pearl if it burns up
 * @param e The event args
 */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityCombustEvent(EntityCombustEvent e) {
    if (!(e.getEntity() instanceof Item)) {
        return;
    }

    ExilePearl pearl = pearlApi.getPearlFromItemStack(((Item) e.getEntity()).getItemStack());
    if (pearl == null) {
        return;
    }

    pearlApi.log("%s (%s) is being freed. Reason: ExilePearl combusted(lava/fire).", pearl.getPlayerName(), pearl.getPlayerId());
    pearlApi.freePearl(pearl, PearlFreeReason.PEARL_DESTROYED);
}
项目:BloodMoon    文件:DaylightProofMobsListener.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityCombust(EntityCombustEvent event) {
    World world = event.getEntity().getWorld();
    EntityType type = event.getEntityType();

    if (type == EntityType.ZOMBIE || type == EntityType.SKELETON) {
        if (plugin.isActive(world) && plugin.isFeatureEnabled(world, Feature.DAYLIGHT_PROOF_MOBS)) {
            event.setCancelled(true);
        }
    }

}
项目:UberHardcore    文件:CustomSkeleton.java   
public void a(EntityLiving entityliving, float f) {
//        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
        int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bz());
        int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bz());
        entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
        if(i > 0) {
            entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
        }

        if(j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || this.getSkeletonType() == 1) {
            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if(!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

        EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bz(), entityarrow, 0.8F);
        if(event1.isCancelled()) {
            event1.getProjectile().remove();
        } else {
            if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
                this.world.addEntity(entityarrow);
            }

            this.makeSound("random.bow", 1.0F, 1.0F / (this.bb().nextFloat() * 0.4F + 0.8F));
        }
    }
项目:UberHardcore    文件:CustomSkeleton.java   
public void a(EntityLiving entityliving, float f) {
//        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
        int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA());
        int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA());
        entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
        if(i > 0) {
            entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
        }

        if(j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if(!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

        EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F);
        if(event1.isCancelled()) {
            event1.getProjectile().remove();
        } else {
            if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
                this.world.addEntity(entityarrow);
            }

            this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F));
        }
    }
项目:UberHardcore    文件:CustomSkeleton.java   
public void a(EntityLiving entityliving, float f) {
//        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
        int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA());
        int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA());
        entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
        if(i > 0) {
            entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
        }

        if(j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if(!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

        EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F);
        if(event1.isCancelled()) {
            event1.getProjectile().remove();
        } else {
            if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
                this.world.addEntity(entityarrow);
            }

            this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F));
        }
    }
项目:CraftBukkit    文件:EntitySkeleton.java   
public void e() {
    if (this.world.w() && !this.world.isStatic) {
        float f = this.d(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    if (this.world.isStatic && this.getSkeletonType() == 1) {
        this.a(0.72F, 2.34F);
    }

    super.e();
}
项目:CraftBukkit    文件:Entity.java   
protected void E() {
    if (!this.fireProof) {
        this.damageEntity(DamageSource.LAVA, 4);

        // CraftBukkit start - Fallen in lava TODO: this event spams!
        if (this instanceof EntityLiving) {
            if (this.fireTicks <= 0) {
                // not on fire yet
                // TODO: shouldn't be sending null for the block.
                org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
                org.bukkit.entity.Entity damagee = this.getBukkitEntity();
                EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
                this.world.getServer().getPluginManager().callEvent(combustEvent);

                if (!combustEvent.isCancelled()) {
                    this.setOnFire(combustEvent.getDuration());
                }
            } else {
                // This will be called every single tick the entity is in lava, so don't throw an event
                this.setOnFire(15);
            }
            return;
        }
        // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls

        this.setOnFire(15);
    }
}
项目:CraftBukkit    文件:EntityZombie.java   
public void e() {
    if (this.world.w() && !this.world.isStatic && !this.isBaby()) {
        float f = this.d(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    if (this.am() && this.getGoalTarget() != null && this.vehicle instanceof EntityChicken) {
        ((EntityInsentient) this.vehicle).getNavigation().a(this.getNavigation().e(), 1.5D);
    }

    super.e();
}
项目:defend-the-village    文件:Main.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityCombust(EntityCombustEvent event) {
    if ((event.getEntity() instanceof Zombie))
        // Only apply if the zombie is in an arena world
        if (this.am.isInGame((Zombie) event.getEntity())) {
            event.setCancelled(true);
    }
}
项目:civcraft    文件:MobLibListener.java   
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityCombust(EntityCombustEvent event) {
    if (event.getEntity() instanceof LivingEntity) {
        if (MobLib.isMobLibEntity((LivingEntity) event.getEntity())) {
            event.setCancelled(true);
        }
    }
}
项目:civcraft    文件:BonusGoodieManager.java   
@EventHandler(priority = EventPriority.MONITOR)
public void OnEntityCombustEvent(EntityCombustEvent event) {
    if (!(event.getEntity() instanceof Item)) {
        return;
    }

    BonusGoodie goodie = CivGlobal.getBonusGoodie(((Item)event.getEntity()).getItemStack());
    if (goodie == null) {
        return;
    }

    goodie.replenish(((Item)event.getEntity()).getItemStack(), (Item)event.getEntity(), null, null);

}
项目:civcraft    文件:PvPLogger.java   
@EventHandler(priority = EventPriority.LOWEST)
    public void onEntityCombust(EntityCombustEvent event) {
        /* Stop our player NPCs from combusting in the sunlight. */
        /* XXX Handled inside the mob lib now... */
//      if (event.getEntity() instanceof LivingEntity) {
//          if (CivGlobal.entityManager.isRemoteEntity((LivingEntity) event.getEntity())) {
//              event.setCancelled(true);
//          }
//      }
    }
项目:Almura-Server    文件:EntitySkeleton.java   
public void c() {
    if (this.world.v() && !this.world.isStatic) {
        float f = this.d(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    if (this.world.isStatic && this.getSkeletonType() == 1) {
        this.a(0.72F, 2.34F);
    }

    super.c();
}
项目:Almura-Server    文件:Entity.java   
protected void A() {
    if (!this.fireProof) {
        // CraftBukkit start - Fallen in lava TODO: this event spams!
        if (this instanceof EntityLiving) {
            Server server = this.world.getServer();

            // TODO: shouldn't be sending null for the block.
            org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
            org.bukkit.entity.Entity damagee = this.getBukkitEntity();

            EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4D);
            server.getPluginManager().callEvent(event);

            if (!event.isCancelled()) {
                damagee.setLastDamageCause(event);
                this.damageEntity(DamageSource.LAVA, (float) event.getDamage());
            }

            if (this.fireTicks <= 0) {
                // not on fire yet
                EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
                server.getPluginManager().callEvent(combustEvent);

                if (!combustEvent.isCancelled()) {
                    this.setOnFire(combustEvent.getDuration());
                }
            } else {
                // This will be called every single tick the entity is in lava, so don't throw an event
                this.setOnFire(15);
            }
            return;
        }
        // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls

        this.damageEntity(DamageSource.LAVA, 4);
        this.setOnFire(15);
    }
}
项目:Almura-Server    文件:EntityZombie.java   
public void c() {
    if (this.world.v() && !this.world.isStatic && !this.isBaby()) {
        float f = this.d(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    super.c();
}
项目:Tweakkit-Server    文件:EntitySkeleton.java   
public void e() {
    if (this.world.w() && !this.world.isStatic) {
        float f = this.d(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    if (this.world.isStatic && this.getSkeletonType() == 1) {
        this.a(0.72F, 2.34F);
    }

    super.e();
}
项目:Tweakkit-Server    文件:Entity.java   
protected void E() {
    if (!this.fireProof) {
        this.damageEntity(DamageSource.LAVA, 4);

        // CraftBukkit start - Fallen in lava TODO: this event spams!
        if (this instanceof EntityLiving) {
            if (this.fireTicks <= 0) {
                // not on fire yet
                // TODO: shouldn't be sending null for the block.
                org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
                org.bukkit.entity.Entity damagee = this.getBukkitEntity();
                EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
                this.world.getServer().getPluginManager().callEvent(combustEvent);

                if (!combustEvent.isCancelled()) {
                    this.setOnFire(combustEvent.getDuration());
                }
            } else {
                // This will be called every single tick the entity is in lava, so don't throw an event
                this.setOnFire(15);
            }
            return;
        }
        // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls

        this.setOnFire(15);
    }
}
项目:Tweakkit-Server    文件:EntityZombie.java   
public void e() {
    if (this.world.w() && !this.world.isStatic && !this.isBaby()) {
        float f = this.d(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    if (this.am() && this.getGoalTarget() != null && this.vehicle instanceof EntityChicken) {
        ((EntityInsentient) this.vehicle).getNavigation().a(this.getNavigation().e(), 1.5D);
    }

    super.e();
}
项目:Cauldron    文件:Entity.java   
protected void setOnFireFromLava()
{
    if (!this.isImmuneToFire)
    {
        // CraftBukkit start - Fallen in lava TODO: this event spams!
        this.attackEntityFrom(DamageSource.lava, 4);

        if (this instanceof EntityLivingBase)
        {
            if (this.fire <= 0)
            {
                // not on fire yet
                // TODO: shouldn't be sending null for the block.
                org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
                org.bukkit.entity.Entity damagee = this.getBukkitEntity();
                EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
                this.worldObj.getServer().getPluginManager().callEvent(combustEvent);

                if (!combustEvent.isCancelled())
                {
                    this.setFire(combustEvent.getDuration());
                }
            }
            else
            {
                // This will be called every single tick the entity is in lava, so don't throw an event
                this.setFire(15);
            }

            return;
        }

        // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
        this.setFire(15);
    }
}
项目:SpigotSource    文件:EntitySkeleton.java   
public void n() {
    if (this.world.B() && !this.world.isClientSide) {
        float f = this.e(1.0F);
        BlockPosition blockposition = this.bz() instanceof EntityBoat ? (new BlockPosition(this.locX, (double) Math.round(this.locY), this.locZ)).up() : new BlockPosition(this.locX, (double) Math.round(this.locY), this.locZ);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.h(blockposition)) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);

            if (itemstack != null) {
                if (itemstack.e()) {
                    itemstack.setData(itemstack.h() + this.random.nextInt(2));
                    if (itemstack.h() >= itemstack.j()) {
                        this.b(itemstack);
                        this.setSlot(EnumItemSlot.HEAD, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    if (this.world.isClientSide) {
        this.b(this.getSkeletonType());
    }

    super.n();
}
项目:SpigotSource    文件:Entity.java   
protected void burnFromLava() {
    if (!this.fireProof) {
        this.damageEntity(DamageSource.LAVA, 4.0F);

        // CraftBukkit start - Fallen in lava TODO: this event spams!
        if (this instanceof EntityLiving) {
            if (fireTicks <= 0) {
                // not on fire yet
                // TODO: shouldn't be sending null for the block
                org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
                org.bukkit.entity.Entity damagee = this.getBukkitEntity();
                EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
                this.world.getServer().getPluginManager().callEvent(combustEvent);

                if (!combustEvent.isCancelled()) {
                    this.setOnFire(combustEvent.getDuration());
                }
            } else {
                // This will be called every single tick the entity is in lava, so don't throw an event
                this.setOnFire(15);
            }
            return;
        }
        // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
        this.setOnFire(15);
    }
}
项目:SpigotSource    文件:EntityZombie.java   
public void n() {
    if (this.world.B() && !this.world.isClientSide && !this.isBaby()) {
        float f = this.e(1.0F);
        BlockPosition blockposition = this.bz() instanceof EntityBoat ? (new BlockPosition(this.locX, (double) Math.round(this.locY), this.locZ)).up() : new BlockPosition(this.locX, (double) Math.round(this.locY), this.locZ);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.h(blockposition)) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD);

            if (itemstack != null) {
                if (itemstack.e()) {
                    itemstack.setData(itemstack.h() + this.random.nextInt(2));
                    if (itemstack.h() >= itemstack.j()) {
                        this.b(itemstack);
                        this.setSlot(EnumItemSlot.HEAD, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    super.n();
}
项目:xEssentials-deprecated-bukkit    文件:BackpackDespawningEvent.java   
@EventHandler
public void onCombustEvent(EntityCombustEvent e) {
    if(e.getEntity() instanceof Item) {
        Item item = (Item) e.getEntity();
        if(pl.getManagers().getBackPackManager().isBackpack(item.getItemStack())) {
            Backpack pack = pl.getManagers().getBackPackManager().getBackpackByItem(item.getItemStack());
            pack.remove();
        }
    }
}
项目:Craft-city    文件:EntitySkeleton.java   
public void c() {
    if (this.world.u() && !this.world.isStatic) {
        float f = this.c(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
            EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
            this.world.getServer().getPluginManager().callEvent(event);

            if (!event.isCancelled()) {
                this.setOnFire(event.getDuration());
            }
            // CraftBukkit end
            }
        }
    }

    if (this.world.isStatic && this.getSkeletonType() == 1) {
        this.a(0.72F, 2.34F);
    }

    super.c();
}
项目:Craft-city    文件:Entity.java   
protected void z() {
    if (!this.fireProof) {
        // CraftBukkit start - Fallen in lava TODO: this event spams!
        if (this instanceof EntityLiving) {
            Server server = this.world.getServer();

            // TODO: shouldn't be sending null for the block.
            org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
            org.bukkit.entity.Entity damagee = this.getBukkitEntity();

            EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4);
            server.getPluginManager().callEvent(event);

            if (!event.isCancelled()) {
                damagee.setLastDamageCause(event);
                this.damageEntity(DamageSource.LAVA, event.getDamage());
            }

            if (this.fireTicks <= 0) {
                // not on fire yet
                EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
                server.getPluginManager().callEvent(combustEvent);

                if (!combustEvent.isCancelled()) {
                    this.setOnFire(combustEvent.getDuration());
                }
            } else {
                // This will be called every single tick the entity is in lava, so don't throw an event
                this.setOnFire(15);
            }
            return;
        }
        // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls

        this.damageEntity(DamageSource.LAVA, 4);
        this.setOnFire(15);
    }
}
项目:Craft-city    文件:EntityZombie.java   
public void c() {
    if (this.world.u() && !this.world.isStatic && !this.isBaby()) {
        float f = this.c(1.0F);

        if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
            boolean flag = true;
            ItemStack itemstack = this.getEquipment(4);

            if (itemstack != null) {
                if (itemstack.g()) {
                    itemstack.setData(itemstack.j() + this.random.nextInt(2));
                    if (itemstack.j() >= itemstack.l()) {
                        this.a(itemstack);
                        this.setEquipment(4, (ItemStack) null);
                    }
                }

                flag = false;
            }

            if (flag) {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    this.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        }
    }

    super.c();
}
项目:ZentrelaRPG    文件:EnvironmentManager.java   
@EventHandler
public void onEntityCombust(EntityCombustEvent event) {
    event.getEntity().setFireTicks(0);
    event.setCancelled(true);
}
项目:mczone    文件:Events.java   
@EventHandler
public void onEntityCombust(EntityCombustEvent event) {
    event.setCancelled(true);
}
项目:Carbon-2    文件:ItemNewBow.java   
@Override
public void a(ItemStack itemstack, World world, EntityHuman player, int usedFor) {
    final boolean flag = player.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;
    int arrowSlot = this.findArrowSlot(player.inventory);
    if (flag || arrowSlot != -1) {
        ItemStack arrowItemStack = arrowSlot != -1 ? player.inventory.getItem(arrowSlot) : new ItemStack(Items.ARROW);
        final int j = this.d(itemstack) - usedFor;
        float ready = j / 20.0f;
        ready = (ready * ready + ready * 2.0f) / 3.0f;
        if (ready < 0.1) {
            return;
        }
        if (ready > 1.0f) {
            ready = 1.0f;
        }
        EntityArrow entityarrow = null;
        if (arrowItemStack.getItem() instanceof ItemNewArrow) {
            entityarrow = ((ItemNewArrow) arrowItemStack.getItem()).createArrowEntity(world, arrowItemStack, player, ready);
        } else {
            entityarrow = new EntityArrow(world, player, ready * 2.0f);
        }
        if (ready == 1.0f) {
            entityarrow.setCritical(true);
        }
        final int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);
        if (k > 0) {
            entityarrow.b(entityarrow.j() + k * 0.5 + 0.5);
        }
        final int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);
        if (l > 0) {
            entityarrow.setKnockbackStrength(l);
        }
        if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) {
            final EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            entityarrow.world.getServer().getPluginManager().callEvent(event);
            if (!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }
        final EntityShootBowEvent event2 = CraftEventFactory.callEntityShootBowEvent(player, itemstack, entityarrow, ready);
        if (event2.isCancelled()) {
            event2.getProjectile().remove();
            return;
        }
        if (event2.getProjectile() == entityarrow.getBukkitEntity()) {
            world.addEntity(entityarrow);
        }
        itemstack.damage(1, player);
        world.makeSound(player, "random.bow", 1.0f, 1.0f / (ItemNewBow.g.nextFloat() * 0.4f + 1.2f) + ready * 0.5f);
        if (flag) {
            entityarrow.fromPlayer = 2;
        } else {
            player.inventory.a(Items.ARROW);
        }
        player.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]);
    }
}
项目:BloodMoon    文件:EntitySkeleton.java   
@Override
    public void a(net.minecraft.server.v1_8_R3.EntityLiving entityLiving, float f) {

        final EntityArrow entityarrow = new EntityArrow(this.world, this, entityLiving, 1.6f, 14 - this.world.getDifficulty().a() * 4);
        int arrow_damage = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, bA());//assumming bz()
        int knockback = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, bA()); //assumming bz()
        entityarrow.b(f * 2.0F + this.random.nextGaussian() * 0.25D + this.world.getDifficulty().a() * 0.11F);
        if (arrow_damage > 0) {
            entityarrow.b(entityarrow.j() + arrow_damage * 0.5 + 0.5);
            //set enchantment level
        }

        if (knockback > 0) {
            entityarrow.setKnockbackStrength(knockback);
        }

        //String worldName = this.world.worldData.getName();
        //PluginConfig worldConfig = plugin.getConfig(worldName);
        World bukkitWorld = this.world.worldData.world.getWorld();
        PluginConfig worldConfig = plugin.getConfig(bukkitWorld);

        if (plugin.isActive(bukkitWorld) && worldConfig.getBoolean(Config.FEATURE_FIRE_ARROWS_ENABLED) && (this.random.nextInt(100) < worldConfig.getInt(Config.FEATURE_FIRE_ARROWS_CHANCE))
                || (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1)) {
            final EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if (!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

//        if (plugin.isActive(worldName) && worldConfig.getBoolean(Config.FEATURE_FIRE_ARROWS_ENABLED) && (this.random.nextInt(100) < worldConfig.getInt(Config.FEATURE_FIRE_ARROWS_CHANCE))) {
//            //if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || getSkeletonType() == 1) {
//            //entityarrow.setOnFire(1024);
//            //}
//        }
        final EntityShootBowEvent event2 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8f);
        if (event2.isCancelled()) {
            event2.getProjectile().remove();
            return;
        }
        if (event2.getProjectile() == entityarrow.getBukkitEntity()) {
            this.world.addEntity(entityarrow);
        }
        this.makeSound("random.bow", 1.0f, 1.0f / (this.bc().nextFloat() * 0.4f + 0.8f));

        //this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.aI().nextFloat() * 0.4F + 0.8F));
        //world.makeSound(this, "random.bow", 1.0F, 1.0F / (random.nextFloat() * 0.4F + 0.8F));
        //this.world.addEntity(entityarrow);
    }
项目:MiniMiniGames    文件:WorldListener.java   
@EventHandler
public void onEntityCombustEvent(EntityCombustEvent event) {
   if (event.getDuration() == 8 && !(event.getEntity() instanceof Player)) {
      event.setCancelled(true);
   }
}
项目:Carbon-2    文件:ItemNewBow.java   
@Override
public void a(ItemStack itemstack, World world, EntityHuman player, int usedFor) {
    final boolean flag = player.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;
    int arrowSlot = this.findArrowSlot(player.inventory);
    if (flag || arrowSlot != -1) {
        ItemStack arrowItemStack = arrowSlot != -1 ? player.inventory.getItem(arrowSlot) : new ItemStack(Items.ARROW);
        final int j = this.d(itemstack) - usedFor;
        float ready = j / 20.0f;
        ready = (ready * ready + ready * 2.0f) / 3.0f;
        if (ready < 0.1) {
            return;
        }
        if (ready > 1.0f) {
            ready = 1.0f;
        }
        EntityArrow entityarrow = null;
        if (arrowItemStack.getItem() instanceof ItemNewArrow) {
            entityarrow = ((ItemNewArrow) arrowItemStack.getItem()).createArrowEntity(world, arrowItemStack, player, ready);
        } else {
            entityarrow = new EntityArrow(world, player, ready * 2.0f);
        }
        if (ready == 1.0f) {
            entityarrow.setCritical(true);
        }
        final int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);
        if (k > 0) {
            entityarrow.b(entityarrow.j() + k * 0.5 + 0.5);
        }
        final int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);
        if (l > 0) {
            entityarrow.setKnockbackStrength(l);
        }
        if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) {
            final EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            entityarrow.world.getServer().getPluginManager().callEvent(event);
            if (!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }
        final EntityShootBowEvent event2 = CraftEventFactory.callEntityShootBowEvent(player, itemstack, entityarrow, ready);
        if (event2.isCancelled()) {
            event2.getProjectile().remove();
            return;
        }
        if (event2.getProjectile() == entityarrow.getBukkitEntity()) {
            world.addEntity(entityarrow);
        }
        itemstack.damage(1, player);
        world.makeSound(player, "random.bow", 1.0f, 1.0f / (ItemNewBow.g.nextFloat() * 0.4f + 1.2f) + ready * 0.5f);
        if (flag) {
            entityarrow.fromPlayer = 2;
        } else {
            player.inventory.a(Items.ARROW);
        }
        player.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]);
    }
}
项目:Cauldron    文件:EntitySkeleton.java   
public void onLivingUpdate()
{
    if (this.worldObj.isDaytime() && !this.worldObj.isRemote)
    {
        float f = this.getBrightness(1.0F);

        if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)))
        {
            boolean flag = true;
            ItemStack itemstack = this.getEquipmentInSlot(4);

            if (itemstack != null)
            {
                if (itemstack.isItemStackDamageable())
                {
                    itemstack.setItemDamage(itemstack.getItemDamageForDisplay() + this.rand.nextInt(2));

                    if (itemstack.getItemDamageForDisplay() >= itemstack.getMaxDamage())
                    {
                        this.renderBrokenItemStack(itemstack);
                        this.setCurrentItemOrArmor(4, (ItemStack)null);
                    }
                }

                flag = false;
            }

            if (flag)
            {
                // CraftBukkit start
                EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
                this.worldObj.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled())
                {
                    this.setFire(event.getDuration());
                }

                // CraftBukkit end
            }
        }
    }

    if (this.worldObj.isRemote && this.getSkeletonType() == 1)
    {
        this.setSize(0.72F, 2.34F);
    }

    super.onLivingUpdate();
}