Ejemplo n.º 1
0
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
 public void damageHandler(EntityDamageByEntityEvent event) {
   if (event.getDamager().getType() == EntityType.PLAYER) {
     Player player = (Player) event.getDamager();
     AnniPlayer p = AnniPlayer.getPlayer(player.getUniqueId());
     if (p != null && p.getKit().equals(this) && p.getData("Cur") != null) endLeap(player, p);
   }
 }
Ejemplo n.º 2
0
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
 public void damageHandler(EntityDamageEvent event) {
   if (event.getEntityType() == EntityType.PLAYER) {
     AnniPlayer p = AnniPlayer.getPlayer(event.getEntity().getUniqueId());
     if (p != null && p.getKit().equals(this) && p.getData("Cur") != null) {
       if (event.getCause() == DamageCause.FALL) event.setCancelled(true);
       else endLeap((Player) event.getEntity(), p);
     }
   }
 }
Ejemplo n.º 3
0
 @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
 public void damageHandler(EntityDamageEvent event) {
   if (event.getEntityType() == EntityType.PLAYER) {
     AnniPlayer p = AnniPlayer.getPlayer(event.getEntity().getUniqueId());
     if (p != null
         && p.getTeam() != null
         && !p.getTeam().isTeamDead()
         && p.getTeam().getNexus().getLocation() != null
         && p.getKit().equals(this)) {
       Player player = (Player) event.getEntity();
       if (player.getLocation().distanceSquared(p.getTeam().getNexus().getLocation().toLocation())
           <= 20 * 20)
         player.addPotionEffect(
             new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 0));
       else player.removePotionEffect(PotionEffectType.REGENERATION);
     }
   }
 }