org.bukkit.event.entity.EntityCombustByBlockEvent Java Examples

The following examples show how to use org.bukkit.event.entity.EntityCombustByBlockEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityEventHandler.java    From GriefDefender with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDamage(EntityCombustByBlockEvent event) {
    GDTimings.ENTITY_DAMAGE_EVENT.startTiming();
    Object source = event.getCombuster();
    if (source == null) {
        source = NMSUtil.getInstance().getFlameableBlock(event.getEntity());
    }
    if (protectEntity(event, source, event.getEntity())) {
        event.setCancelled(true);
    }
    GDTimings.ENTITY_DAMAGE_EVENT.stopTiming();
}
 
Example #2
Source File: DisableDamageMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void handleIgnition(EntityCombustByBlockEvent event) {
  MatchPlayer victim = match.getParticipant(event.getEntity());
  if (victim == null) return;

  ParticipantState attacker =
      match.needModule(TrackerMatchModule.class).getOwner(event.getCombuster());

  // Disabling FIRE/LAVA damage also prevents setting on fire
  if (!this.canDamage(getBlockDamageCause(event.getCombuster()), victim, attacker)) {
    event.setCancelled(true);
  }
}
 
Example #3
Source File: DamageMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onIgnition(EntityCombustByBlockEvent event) {
  MatchPlayer victim = getVictim(event.getEntity());
  if (victim == null) return;

  processDamageEvent(
      event,
      victim.getParticipantState(),
      tracker()
          .resolveDamage(
              EntityDamageEvent.DamageCause.FIRE, event.getEntity(), event.getCombuster()));
}
 
Example #4
Source File: FireTracker.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
@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())));
  }
}
 
Example #5
Source File: DisableDamageMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example #6
Source File: DamageMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@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()));
}
 
Example #7
Source File: FireTracker.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@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())));
    }
}
 
Example #8
Source File: ObserverModule.java    From CardinalPGM with MIT License 4 votes vote down vote up
@EventHandler
public void onEntityCombustEvent(EntityCombustByBlockEvent event) {
    if (event.getEntity() instanceof Player && testObserver((Player)event.getEntity())){
        event.getEntity().setFireTicks(0);
    }
}