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

项目: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());
}
项目:CraftBukkit    文件:EntityZombie.java   
public boolean n(Entity entity) {
    boolean flag = super.n(entity);

    if (flag) {
        int i = this.world.difficulty.a();

        if (this.be() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
            // CraftBukkit start
            EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i);
            this.world.getServer().getPluginManager().callEvent(event);

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

    return flag;
}
项目:Almura-Server    文件:EntityZombie.java   
public boolean m(Entity entity) {
    boolean flag = super.m(entity);

    if (flag && this.aZ() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
        // CraftBukkit start
        EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * this.world.difficulty);
        this.world.getServer().getPluginManager().callEvent(event);

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

    return flag;
}
项目:Tweakkit-Server    文件:EntityZombie.java   
public boolean n(Entity entity) {
    boolean flag = super.n(entity);

    if (flag) {
        int i = this.world.difficulty.a();

        if (this.be() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
            // CraftBukkit start
            EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i);
            this.world.getServer().getPluginManager().callEvent(event);

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

    return flag;
}
项目:PlotSquared    文件:PlayerEvents.java   
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
    EntityDamageByEntityEvent eventChange = null;
    if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
        eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
                EntityDamageEvent.DamageCause.FIRE_TICK, (double)event.getDuration());
    } else {
        try {
            Constructor<EntityDamageByEntityEvent> constructor = EntityDamageByEntityEvent.class.getConstructor(Entity.class,
                    Entity.class, EntityDamageEvent.DamageCause.class, Integer.TYPE);
            eventChange = constructor.newInstance(event.getCombuster(), event.getEntity(),
                    EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration());
        } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    if (eventChange == null) {
        return;
    }
    onEntityDamageByEntityEvent(eventChange);
    if (eventChange.isCancelled()) {
        event.setCancelled(true);
    }
}
项目:Cauldron    文件:EntityZombie.java   
public boolean attackEntityAsMob(Entity p_70652_1_)
{
    boolean flag = super.attackEntityAsMob(p_70652_1_);

    if (flag)
    {
        int i = this.worldObj.difficultySetting.getDifficultyId();

        if (this.getHeldItem() == null && this.isBurning() && this.rand.nextFloat() < (float)i * 0.3F)
        {
            // CraftBukkit start
            EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), p_70652_1_.getBukkitEntity(), 2 * i);
            this.worldObj.getServer().getPluginManager().callEvent(event);

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

            // CraftBukkit end
        }
    }

    return flag;
}
项目:SpigotSource    文件:EntityZombie.java   
public boolean B(Entity entity) {
    boolean flag = super.B(entity);

    if (flag) {
        int i = this.world.getDifficulty().a();

        if (this.getItemInMainHand() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) {
            // CraftBukkit start
            EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i);
            this.world.getServer().getPluginManager().callEvent(event);

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

    return flag;
}
项目:Craft-city    文件:EntityZombie.java   
public boolean m(Entity entity) {
    boolean flag = super.m(entity);

    if (flag && this.bG() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
        // CraftBukkit start
        EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * this.world.difficulty);
        this.world.getServer().getPluginManager().callEvent(event);

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

    return flag;
}
项目: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());
    }
}
项目:ProjectAres    文件:DamageMatchModule.java   
@EventHandler(ignoreCancelled = true)
public void onIgnition(EntityCombustByEntityEvent event) {
    MatchPlayer victim = getVictim(event.getEntity());
    if(victim == null) return;
    processDamageEvent(event, victim.getParticipantState(),
                       damageResolver.resolveDamage(EntityDamageEvent.DamageCause.FIRE, event.getEntity(), event.getCombuster()));
}
项目:ProjectAres    文件:FireTracker.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityIgnite(EntityCombustByEntityEvent event) {
    if(event.getDuration() == 0) return;

    FireInfo info = resolveBurning(event.getCombuster());
    if(info != null) {
        // First, try to resolve the player who ignited the combuster
        info = new FireInfo(new EntityInfo(event.getCombuster(), info.getOwner()));
    } else {
        // If an igniter is not found, fall back to the owner of the entity
        info = new FireInfo(entities.resolveEntity(event.getCombuster()));
    }

    burningEntities.put(event.getEntity(), info);
}
项目: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);
}
项目:Parties    文件:FightListener.java   
@EventHandler
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
    if (Variables.friendlyfire_enable
            && event.getEntity() instanceof Player
            && event.getCombuster() instanceof Projectile
            && ((Projectile) event.getCombuster()).getShooter() instanceof Player) {
        Player victim = (Player) event.getEntity();
        Player attacker = (Player)((Projectile) event.getCombuster()).getShooter();

        // Found right attacker
        if (!victim.getUniqueId().equals(attacker.getUniqueId())
                && (Variables.friendlyfire_listworlds.contains("*")
                        || Variables.friendlyfire_listworlds.contains(victim.getWorld().getName()))) {
            // Friendly fire not allowed here
            ThePlayer tpVictim = plugin.getPlayerHandler().getPlayer(victim.getUniqueId());
            ThePlayer tpAttacker = plugin.getPlayerHandler().getPlayer(attacker.getUniqueId());

            if (!tpVictim.getPartyName().isEmpty() && tpVictim.getPartyName().equalsIgnoreCase(tpAttacker.getPartyName())) {
                // Calling API event
                PartiesCombustFriendlyFireBlockedEvent partiesFriendlyFireEvent = new PartiesCombustFriendlyFireBlockedEvent(victim, attacker, event);
                Bukkit.getServer().getPluginManager().callEvent(partiesFriendlyFireEvent);
                if (!partiesFriendlyFireEvent.isCancelled()) {
                    // Friendly fire confirmed
                    Party party = plugin.getPartyHandler().getParty(tpVictim.getPartyName());

                    tpAttacker.sendMessage(Messages.canthitmates);
                    party.sendFriendlyFireWarn(tpVictim, tpAttacker);

                    event.setCancelled(true);
                    LogHandler.log(LogLevel.DEBUG, "Denied PvP friendly fire [Entity combust] between A:'" + attacker.getName() + "' and V:'" + victim.getName() + "'", true);
                } else
                    LogHandler.log(LogLevel.DEBUG, "PartiesCombustFriendlyFireBlockedEvent is cancelled, ignoring [Entity combust] between A:'" + attacker.getName() + "' and V:'" + victim.getName() + "'", true);

            }
        }

    }
}
项目:GriefPreventionFlags    文件:FlagDef_AllowPvP.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onEntityCombustByEntity (EntityCombustByEntityEvent event)
{
    //handle it just like we would an entity damge by entity event, except don't send player messages to avoid double messages
    //in cases like attacking with a flame sword or flame arrow, which would ALSO trigger the direct damage event handler
    @SuppressWarnings("deprecation")
    EntityDamageByEntityEvent eventWrapper = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), DamageCause.FIRE_TICK, event.getDuration());
    this.handleEntityDamageEvent(eventWrapper, false);
    event.setCancelled(eventWrapper.isCancelled());
}
项目:Pokkit    文件:EntityEvents.java   
private void onEntityCombustByEntity(cn.nukkit.event.entity.EntityCombustByEntityEvent event) {
    // Called by onEntityCombust, so don't use an @EventHandler annotation

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

    callCancellable(event, bukkitEvent);
    event.setDuration(bukkitEvent.getDuration());
}
项目:RedProtect    文件:RPMine18.java   
@EventHandler(priority = EventPriority.HIGHEST)
  public void entityFire(EntityCombustByEntityEvent e){
    if (e.isCancelled()) {
          return;
      }

      Entity e1 = e.getEntity();
      Entity e2 = e.getCombuster();
      Location loc = e1.getLocation();

      if (e2 instanceof Projectile) {
        Projectile a = (Projectile)e2;                
          if (a.getShooter() instanceof Entity){
            e2 = (Entity)a.getShooter(); 
          }
          a = null;
          if (e2 == null) {
              return;
          }
      }

Region r1 = RedProtect.get().rm.getTopRegion(loc);

if (r1 == null){
    //global flags
    if (e1 instanceof ArmorStand && e2 instanceof Player){
        if (!RPConfig.getGlobalFlagBool(loc.getWorld().getName()+".build")){
                e.setCancelled(true);
        }
          }
} else {
    if (e1 instanceof ArmorStand && e2 instanceof Player){
        if (!r1.canBuild(((Player)e2)) && !r1.canBreak(e1.getType())){
            e.setCancelled(true);
            RPLang.sendMessage(e2, "blocklistener.region.cantbreak");
        }
       }
}
  }
项目:CraftBukkit    文件:EntityMonster.java   
public boolean n(Entity entity) {
    float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
    int i = 0;

    if (entity instanceof EntityLiving) {
        f += EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
        i += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
    }

    boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);

    if (flag) {
        if (i > 0) {
            entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
            this.motX *= 0.6D;
            this.motZ *= 0.6D;
        }

        int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);

        if (j > 0) {
            // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
            EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
            org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);

            if (!combustEvent.isCancelled()) {
                entity.setOnFire(combustEvent.getDuration());
            }
            // CraftBukkit end
        }

        if (entity instanceof EntityLiving) {
            EnchantmentManager.a((EntityLiving) entity, (Entity) this);
        }

        EnchantmentManager.b(this, entity);
    }

    return flag;
}
项目:Tweakkit-Server    文件:EntityMonster.java   
public boolean n(Entity entity) {
    float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
    int i = 0;

    if (entity instanceof EntityLiving) {
        f += EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
        i += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
    }

    boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);

    if (flag) {
        if (i > 0) {
            entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
            this.motX *= 0.6D;
            this.motZ *= 0.6D;
        }

        int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);

        if (j > 0) {
            // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
            EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
            org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);

            if (!combustEvent.isCancelled()) {
                entity.setOnFire(combustEvent.getDuration());
            }
            // CraftBukkit end
        }

        if (entity instanceof EntityLiving) {
            EnchantmentManager.a((EntityLiving) entity, (Entity) this);
        }

        EnchantmentManager.b(this, entity);
    }

    return flag;
}
项目:SpigotSource    文件:Entity.java   
public void onLightningStrike(EntityLightning entitylightning) {
    // CraftBukkit start
    final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
    final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
    final PluginManager pluginManager = Bukkit.getPluginManager();

    if (thisBukkitEntity instanceof Hanging) {
        HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
        pluginManager.callEvent(hangingEvent);

        if (hangingEvent.isCancelled()) {
            return;
        }
    }

    if (this.fireProof) {
        return;
    }
    CraftEventFactory.entityDamage = entitylightning;
    if (!this.damageEntity(DamageSource.LIGHTNING, 5.0F)) {
        CraftEventFactory.entityDamage = null;
        return;
    }
    // CraftBukkit end
    ++this.fireTicks;
    if (this.fireTicks == 0) {
        // CraftBukkit start - Call a combust event when lightning strikes
        EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
        pluginManager.callEvent(entityCombustEvent);
        if (!entityCombustEvent.isCancelled()) {
            this.setOnFire(entityCombustEvent.getDuration());
        }
        // CraftBukkit end
    }

}
项目:KingdomFactions    文件:PvPManager.java   
@EventHandler
public void onCombust(EntityCombustByEntityEvent e) {
    if(!(e.getCombuster() instanceof Arrow)) {
        return;
    }
    Arrow proj = (Arrow) e.getCombuster();
    try {
        KingdomFactionsPlayer player = PlayerModule.getInstance().getPlayer(e.getEntity());
        KingdomFactionsPlayer other = PlayerModule.getInstance().getPlayer(proj.getShooter());


        if(!WarModule.getInstance().isWarActive()) {
            if(other.getCurrentNexus() instanceof CapitalNexus || player.getCurrentNexus() instanceof CapitalNexus) {
                e.setCancelled(true);
                return;
            }
            }



        if (player.hasFaction()) {
            if (other.hasFaction()) {
                if (player.getFaction() == other.getFaction()) {
                    e.setCancelled(true);
                 proj.remove();
                } else {
                     player.getCombatTracker().resetCombat();
                     other.getCombatTracker().resetCombat();
                    return;
                }
            }
        } else {
            if (other.hasFaction()) {
                return;
            } else {
                if (player.getKingdom() == other.getKingdom()) {
                    e.setCancelled(true);
                     proj.remove();
                } else {
                     player.getCombatTracker().resetCombat();
                     other.getCombatTracker().resetCombat();
                    return;
                }
            }
        }
    } catch (PlayerException e1) {
        return;
}
}
项目:Parties    文件:PartiesCombustFriendlyFireBlockedEvent.java   
public PartiesCombustFriendlyFireBlockedEvent(Player victim, Player attacker, EntityCombustByEntityEvent originalEvent) {
    this.victim = victim;
    this.attacker = attacker;
    this.originalEvent = originalEvent;
}
项目:ExilePearl    文件:ExileListener.java   
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerCombust(EntityCombustByEntityEvent e) {
    Player player = new EntityCombustEventWrapper(e).getPlayerDamager();
    if (player == null) {
        return;
    }

    if (e.getEntity() instanceof Player) {
        checkAndCancelRule(ExileRule.PVP, e, player);
        return;
    }

    if (!(e.getEntity() instanceof LivingEntity)) {
        return;
    }

    // Let players kill mythic mobs
    if (pearlApi.isMythicMob(e.getEntity())) {
        return;
    }

    LivingEntity living = (LivingEntity)e.getEntity();
    String name = living.getCustomName();

    if (name != null && name != "") {
        checkAndCancelRule(ExileRule.KILL_PETS, e, player);
        return;
    }

    if (!isRuleActive(ExileRule.KILL_MOBS, player.getUniqueId())) {
        return;
    }

    for(String animal : protectedAnimals) {
        Class<?> clazz = null;

        try {
            clazz = Class.forName("org.bukkit.entity." + animal);
        } catch (Exception ex) {
            continue;
        }

        if (clazz != null && clazz.isInstance(living)) {
            checkAndCancelRule(ExileRule.KILL_MOBS, e, player);
            return;
        }
    }
}
项目:ExilePearl    文件:EntityCombustEventWrapper.java   
public EntityCombustEventWrapper(final EntityCombustByEntityEvent event) {
    Guard.ArgumentNotNull(event, "event");

    this.event = event;
}
项目:ExilePearl    文件:EntityCombustEventWrapper.java   
public EntityCombustByEntityEvent getEvent() {
    return event;
}
项目:CraftBukkit    文件:EntitySmallFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F)) {
                // CraftBukkit start - Entity damage by entity event + combust event
                EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
                movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    movingobjectposition.entity.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        } else {
            int i = movingobjectposition.b;
            int j = movingobjectposition.c;
            int k = movingobjectposition.d;

            switch (movingobjectposition.face) {
            case 0:
                --j;
                break;

            case 1:
                ++j;
                break;

            case 2:
                --k;
                break;

            case 3:
                ++k;
                break;

            case 4:
                --i;
                break;

            case 5:
                ++i;
            }

            if (this.world.isEmpty(i, j, k)) {
                // CraftBukkit start
                if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
                    this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
                }
                // CraftBukkit end
            }
        }

        this.die();
    }
}
项目:Almura-Server    文件:EntitySmallFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F)) {
                // CraftBukkit start - Entity damage by entity event + combust event
                EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
                movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    movingobjectposition.entity.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        } else {
            int i = movingobjectposition.b;
            int j = movingobjectposition.c;
            int k = movingobjectposition.d;

            switch (movingobjectposition.face) {
            case 0:
                --j;
                break;

            case 1:
                ++j;
                break;

            case 2:
                --k;
                break;

            case 3:
                ++k;
                break;

            case 4:
                --i;
                break;

            case 5:
                ++i;
            }

            if (this.world.isEmpty(i, j, k)) {
                // CraftBukkit start
                if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
                    this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
                }
                // CraftBukkit end
            }
        }

        this.die();
    }
}
项目:Tweakkit-Server    文件:EntitySmallFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F)) {
                // CraftBukkit start - Entity damage by entity event + combust event
                EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
                movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    movingobjectposition.entity.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        } else {
            int i = movingobjectposition.b;
            int j = movingobjectposition.c;
            int k = movingobjectposition.d;

            switch (movingobjectposition.face) {
            case 0:
                --j;
                break;

            case 1:
                ++j;
                break;

            case 2:
                --k;
                break;

            case 3:
                ++k;
                break;

            case 4:
                --i;
                break;

            case 5:
                ++i;
            }

            if (this.world.isEmpty(i, j, k)) {
                // CraftBukkit start
                if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
                    this.world.setTypeUpdate(i, j, k, Blocks.FIRE);
                }
                // CraftBukkit end
            }
        }

        this.die();
    }
}
项目:Cauldron    文件:EntitySmallFireball.java   
protected void onImpact(MovingObjectPosition p_70227_1_)
{
    if (!this.worldObj.isRemote)
    {
        if (p_70227_1_.entityHit != null)
        {
            if (!p_70227_1_.entityHit.isImmuneToFire() && p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5.0F))
            {
                // CraftBukkit start - Entity damage by entity event + combust event
                EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), p_70227_1_.entityHit.getBukkitEntity(), 5);
                p_70227_1_.entityHit.worldObj.getServer().getPluginManager().callEvent(event);

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

                // CraftBukkit end
            }
        }
        else
        {
            int i = p_70227_1_.blockX;
            int j = p_70227_1_.blockY;
            int k = p_70227_1_.blockZ;

            switch (p_70227_1_.sideHit)
            {
                case 0:
                    --j;
                    break;
                case 1:
                    ++j;
                    break;
                case 2:
                    --k;
                    break;
                case 3:
                    ++k;
                    break;
                case 4:
                    --i;
                    break;
                case 5:
                    ++i;
            }

            if (this.worldObj.isAirBlock(i, j, k))
            {
                // CraftBukkit start
                if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldObj, i, j, k, this).isCancelled())
                {
                    this.worldObj.setBlock(i, j, k, Blocks.fire);
                }

                // CraftBukkit end
            }
        }

        this.setDead();
    }
}
项目:SpigotSource    文件:EntitySmallFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isClientSide) {
        boolean flag;

        if (movingobjectposition.entity != null) {
            if (!movingobjectposition.entity.isFireProof()) {
                flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
                if (flag) {
                    this.a(this.shooter, movingobjectposition.entity);
                    // CraftBukkit start - Entity damage by entity event + combust event
                    EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
                    movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);

                    if (!event.isCancelled()) {
                        movingobjectposition.entity.setOnFire(event.getDuration());
                    }
                    // CraftBukkit end
                }
            }
        } else {
            flag = true;
            if (this.shooter != null && this.shooter instanceof EntityInsentient) {
                flag = this.world.getGameRules().getBoolean("mobGriefing");
            }

            if (flag) {
                BlockPosition blockposition = movingobjectposition.a().shift(movingobjectposition.direction);

                if (this.world.isEmpty(blockposition)) {
                    // CraftBukkit start
                    if (isIncendiary && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) {
                        this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
                    }
                    // CraftBukkit end
                }
            }
        }

        this.die();
    }

}
项目:SpigotSource    文件:EntityMonster.java   
public boolean B(Entity entity) {
    float f = (float) this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).getValue();
    int i = 0;

    if (entity instanceof EntityLiving) {
        f += EnchantmentManager.a(this.getItemInMainHand(), ((EntityLiving) entity).getMonsterType());
        i += EnchantmentManager.a((EntityLiving) this);
    }

    boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);

    if (flag) {
        if (i > 0 && entity instanceof EntityLiving) {
            ((EntityLiving) entity).a(this, (float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)));
            this.motX *= 0.6D;
            this.motZ *= 0.6D;
        }

        int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);

        if (j > 0) {
            // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
            EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
            org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);

            if (!combustEvent.isCancelled()) {
                entity.setOnFire(combustEvent.getDuration());
            }
            // CraftBukkit end
        }

        if (entity instanceof EntityHuman) {
            EntityHuman entityhuman = (EntityHuman) entity;
            ItemStack itemstack = this.getItemInMainHand();
            ItemStack itemstack1 = entityhuman.ct() ? entityhuman.cw() : null;

            if (itemstack != null && itemstack1 != null && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD) {
                float f1 = 0.25F + (float) EnchantmentManager.getDigSpeedEnchantmentLevel(this) * 0.05F;

                if (this.random.nextFloat() < f1) {
                    entityhuman.db().a(Items.SHIELD, 100);
                    this.world.broadcastEntityEffect(entityhuman, (byte) 30);
                }
            }
        }

        this.a((EntityLiving) this, entity);
    }

    return flag;
}
项目:Craft-city    文件:EntitySmallFireball.java   
protected void a(MovingObjectPosition movingobjectposition) {
    if (!this.world.isStatic) {
        if (movingobjectposition.entity != null) {
            if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5)) {
                // CraftBukkit start - Entity damage by entity event + combust event
                EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
                movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);

                if (!event.isCancelled()) {
                    movingobjectposition.entity.setOnFire(event.getDuration());
                }
                // CraftBukkit end
            }
        } else {
            int i = movingobjectposition.b;
            int j = movingobjectposition.c;
            int k = movingobjectposition.d;

            switch (movingobjectposition.face) {
            case 0:
                --j;
                break;

            case 1:
                ++j;
                break;

            case 2:
                --k;
                break;

            case 3:
                ++k;
                break;

            case 4:
                --i;
                break;

            case 5:
                ++i;
            }

            if (this.world.isEmpty(i, j, k)) {
                // CraftBukkit start
                if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) {
                    this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
                }
                // CraftBukkit end
            }
        }

        this.die();
    }
}
项目:Parties    文件:PartiesCombustFriendlyFireBlockedEvent.java   
/**
 * Gets the original Bukkit event handled by Parties
 * 
 * @return The original Bukkit event
 */
public EntityCombustByEntityEvent getOriginalEvent() {
    return originalEvent;
}