当前位置: 首页>>代码示例>>Java>>正文


Java EntityCombustEvent类代码示例

本文整理汇总了Java中org.bukkit.event.entity.EntityCombustEvent的典型用法代码示例。如果您正苦于以下问题:Java EntityCombustEvent类的具体用法?Java EntityCombustEvent怎么用?Java EntityCombustEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EntityCombustEvent类属于org.bukkit.event.entity包,在下文中一共展示了EntityCombustEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:nfell2009,项目名称:Skript,代码行数:27,代码来源:EffIgnite.java

示例2: onEntityCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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());
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:25,代码来源:EntityEvents.java

示例3: onEntityCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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);
			}
		}
	}
}
 
开发者ID:MineSworn,项目名称:SwornCritters,代码行数:17,代码来源:EntityListener.java

示例4: onCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:EventFilterMatchModule.java

示例5: onCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:homiedion,项目名称:Sunscreen,代码行数:38,代码来源:CombustionListener.java

示例6: onBurn

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:kadeska,项目名称:MT_Core,代码行数:12,代码来源:MobListener.java

示例7: onEntityCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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);
			}
		}
	}
}
 
开发者ID:7rory768,项目名称:SimpleFreeze,代码行数:11,代码来源:EntityCombustListener.java

示例8: onEntityCombustEvent

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:DevotedMC,项目名称:ExilePearl,代码行数:19,代码来源:PlayerListener.java

示例9: onEntityCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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);
        }
    }

}
 
开发者ID:Samistine,项目名称:BloodMoon,代码行数:13,代码来源:DaylightProofMobsListener.java

示例10: a

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
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));
        }
    }
 
开发者ID:Eluinhost,项目名称:UberHardcore,代码行数:34,代码来源:CustomSkeleton.java

示例11: a

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
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));
        }
    }
 
开发者ID:Eluinhost,项目名称:UberHardcore,代码行数:34,代码来源:CustomSkeleton.java

示例12: e

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
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();
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:40,代码来源:EntitySkeleton.java

示例13: E

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
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);
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:29,代码来源:Entity.java

示例14: e

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
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();
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:40,代码来源:EntityZombie.java

示例15: onEntityCombust

import org.bukkit.event.entity.EntityCombustEvent; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:odarriba,项目名称:defend-the-village,代码行数:9,代码来源:Main.java


注:本文中的org.bukkit.event.entity.EntityCombustEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。