org.bukkit.event.entity.EntityTargetLivingEntityEvent Java Examples

The following examples show how to use org.bukkit.event.entity.EntityTargetLivingEntityEvent. 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: ShadowDive.java    From MineTinker with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onTarget(EntityTargetLivingEntityEvent event) {
	if (event.getTarget() instanceof Player) {
		//noinspection SuspiciousMethodCalls
		if (activePlayers.contains(event.getTarget())) {
			event.setCancelled(true);
		}
	}
}
 
Example #2
Source File: TargetEvent.java    From StackMob-3 with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onEntityTarget(EntityTargetLivingEntityEvent event) {
    if(event.getTarget() instanceof Player && event.getEntity() instanceof Monster){
        if(StackTools.hasSizeMoreThanOne(event.getEntity())){
            if(!sm.getCustomConfig().getStringList("no-targeting.types-blacklist")
                    .contains(event.getEntityType().toString())) {
                event.setCancelled(true);
            }
        }
    }
}
 
Example #3
Source File: VisualEffectObfuscator.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onTargetPlayer(EntityTargetLivingEntityEvent event) {
    if (!(event.getTarget() instanceof Player)) return;
    EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(event.getEntity());
    if (eliteMobEntity == null) return;

    eliteMobEntity.setHasVisualEffectObfuscated(false);
    eliteMobEntity.getLivingEntity().setCustomNameVisible(true);
}
 
Example #4
Source File: Taunt.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onTarget(EntityTargetLivingEntityEvent event) {

    if (EntityTracker.hasPower(this, event.getEntity()))
        if (event.getTarget() instanceof Player) {
            Entity targetter = event.getEntity();
            nametagProcessor(targetter, TARGET_TAUNT_LIST);
        }

}
 
Example #5
Source File: SkeletonTrackingArrow.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void targetEvent(EntityTargetLivingEntityEvent event) {

    EliteMobEntity eliteMobEntity = EventValidator.getEventEliteMob(this, event);
    if (eliteMobEntity == null) return;
    if (currentlyFiringEntities.contains(eliteMobEntity)) return;
    repeatingTrackingArrowTask(event.getEntity());
    currentlyFiringEntities.add(eliteMobEntity);

}
 
Example #6
Source File: AttackArrow.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void targetEvent(EntityTargetLivingEntityEvent event) {
    EliteMobEntity eliteMobEntity = EventValidator.getEventEliteMob(this, event);
    if (eliteMobEntity == null) return;
    if (currentlyFiringEntities.contains(eliteMobEntity)) return;
    repeatingArrowTask(eliteMobEntity);
    currentlyFiringEntities.add(eliteMobEntity);
}
 
Example #7
Source File: AttackFireball.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void targetEvent(EntityTargetLivingEntityEvent event) {
    EliteMobEntity eliteMobEntity = EventValidator.getEventEliteMob(this, event);
    if (eliteMobEntity == null) return;
    if (currentlyFiringEntities.contains(eliteMobEntity)) return;
    repeatingFireballTask((Monster) event.getEntity());
    currentlyFiringEntities.add(eliteMobEntity);
}
 
Example #8
Source File: AggroPrevention.java    From EliteMobs with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onTarget(EntityTargetLivingEntityEvent event) {

    if (EntityTracker.isEliteMob(event.getEntity()) &&
            event.getTarget() != null && EntityTracker.isEliteMob(event.getTarget()) &&
            !(event.getTarget() instanceof IronGolem) && !(event.getEntity() instanceof IronGolem))
        event.setCancelled(true);

}
 
Example #9
Source File: GriefEvents.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onTargeting(EntityTargetLivingEntityEvent e) {
    if (!witherEnabled || !plugin.getWorldManager().isSkyAssociatedWorld(e.getEntity().getWorld())) {
        return;
    }
    if (e.getEntity() instanceof Wither && e.getTarget() != null) {
        handleWitherRampage(e, (Wither) e.getEntity(), e.getTarget().getLocation());
    }
}
 
Example #10
Source File: EntityFinder.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public static LivingEntity getRealDamager(EntityTargetLivingEntityEvent event) {
    return filterRangedDamagers(event.getEntity());
}
 
Example #11
Source File: EntityFinder.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public static Player findPlayer(EntityTargetLivingEntityEvent event) {
    return playerFilter(event.getTarget());
}
 
Example #12
Source File: EventValidator.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public static EliteMobEntity getEventEliteMob(ElitePower mobPower, EntityTargetLivingEntityEvent event) {

        if (event.isCancelled()) return null;

        Player player = EntityFinder.findPlayer(event);

        if (player == null) return null;

        LivingEntity livingEntity = EntityFinder.getRealDamager(event);

        if (livingEntity == null) return null;

        EliteMobEntity eliteMobEntity = EntityTracker.getEliteMobEntity(livingEntity);

        if (eliteMobEntity == null) return null;

        if (!EntityTracker.hasPower(mobPower, eliteMobEntity)) return null;

        return eliteMobEntity;

    }
 
Example #13
Source File: ZombieNecronomicon.java    From EliteMobs with GNU General Public License v3.0 3 votes vote down vote up
@EventHandler
public void onPlayerDetect(EntityTargetLivingEntityEvent event) {

    EliteMobEntity eliteMobEntity = EventValidator.getEventEliteMob(this, event);
    if (eliteMobEntity == null) return;

    if (chantingMobs.contains(eliteMobEntity)) return;
    chantingMobs.add(eliteMobEntity);

    necronomiconVisualEffect(eliteMobEntity);
    spawnReinforcements(eliteMobEntity, event.getTarget());

}