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

项目: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());
}
项目:ProjectAres    文件:DisableDamageMatchModule.java   
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void handleIgnition(EntityCombustByBlockEvent event) {
    MatchPlayer victim = getMatch().getParticipant(event.getEntity());
    if(victim == null) return;

    ParticipantState attacker = blockResolver.getOwner(event.getCombuster());

    // Disabling FIRE/LAVA damage also prevents setting on fire
    if(!this.canDamage(getBlockDamageCause(event.getCombuster()), victim, attacker)) {
        event.setCancelled(true);
    }
}
项目:ProjectAres    文件:DamageMatchModule.java   
@EventHandler(ignoreCancelled = true)
public void onIgnition(EntityCombustByBlockEvent 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(EntityCombustByBlockEvent event) {
    if(event.getDuration() == 0) return;

    ParticipantState owner = blocks.getOwner(event.getCombuster());
    if(owner != null) {
        burningEntities.put(event.getEntity(), new FireInfo(blocks.resolveBlock(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);
}
项目:Cardinal    文件:InteractModule.java   
/**
 * Prevents a player that can't interact from being set on fire.
 *
 * @param event The event.
 */
@EventHandler(ignoreCancelled = true)
public void onEntityCombustByBlock(EntityCombustByBlockEvent event) {
  if (event.getEntity() instanceof Player && !canInteract((Player) event.getEntity())) {
    event.getEntity().setFireTicks(0);
  }
}
项目:CardinalPGM    文件:ObserverModule.java   
@EventHandler
public void onEntityCombustEvent(EntityCombustByBlockEvent event) {
    if (event.getEntity() instanceof Player && testObserver((Player)event.getEntity())){
        event.getEntity().setFireTicks(0);
    }
}
项目:Pokkit    文件:EntityEvents.java   
public void onEntityCombustByBlock(cn.nukkit.event.entity.EntityCombustByBlockEvent event) {
    // Called by onEntityCombust, so don't use an @EventHandler annotation

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

    callCancellable(event, bukkitEvent);
}