本文整理汇总了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);
}
}
}
示例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());
}
示例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);
}
}
}
}
示例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());
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
}
}
示例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));
}
}
示例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));
}
}
示例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();
}
示例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);
}
}
示例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();
}
示例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);
}
}