Java Code Examples for org.bukkit.event.entity.EntityTargetLivingEntityEvent#getTarget()
The following examples show how to use
org.bukkit.event.entity.EntityTargetLivingEntityEvent#getTarget() .
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 |
@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 |
@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 |
@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 |
@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: AggroPrevention.java From EliteMobs with GNU General Public License v3.0 | 5 votes |
@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 6
Source File: GriefEvents.java From uSkyBlock with GNU General Public License v3.0 | 5 votes |
@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()); } }