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


Java EntityCombustByEntityEvent类代码示例

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


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

示例1: onEntityCombust

import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的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

示例2: n

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

示例3: m

import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
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;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:17,代码来源:EntityZombie.java

示例4: onEntityCombustByEntity

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

示例5: attackEntityAsMob

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

示例6: B

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

示例7: m

import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的package包/类
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;
}
 
开发者ID:didoupimpon,项目名称:Craft-city,代码行数:17,代码来源:EntityZombie.java

示例8: onCombust

import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的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

示例9: onIgnition

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

示例10: onEntityIgnite

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

示例11: onCombust

import org.bukkit.event.entity.EntityCombustByEntityEvent; //导入依赖的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

示例12: onEntityCombustByEntity

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

示例13: onEntityCombustByEntity

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

示例14: onEntityCombustByEntity

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

示例15: entityFire

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


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