Пример #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);
   }
 }
Пример #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);
     }
   }
 }
Пример #3
0
 private void endLeap(Player player, AnniPlayer p) {
   if (p.getData("Cur") != null) {
     Object obj = p.getData("Arm");
     if (obj != null && player != null) player.getInventory().setArmorContents((ItemStack[]) obj);
     p.setData("Arm", null);
     if (player != null) {
       player.removePotionEffect(PotionEffectType.INVISIBILITY);
       player.removePotionEffect(PotionEffectType.SPEED);
       player.removePotionEffect(PotionEffectType.FAST_DIGGING);
     }
     p.setData("Cur", null);
   }
 }
Пример #4
0
 @SuppressWarnings("deprecation")
 @Override
 protected boolean performSpecialAction(Player player, AnniPlayer p) {
   p.setData("Arm", player.getInventory().getArmorContents().clone());
   p.setData("Cur", true);
   player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 160, 0));
   player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 160, 0));
   player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 160, 1));
   player.getInventory().setArmorContents(null);
   player.updateInventory();
   player.setVelocity(player.getLocation().getDirection().setY(1).multiply(1));
   new EndLeap(player, p).runTaskLater(AnnihilationMain.getInstance(), 160);
   return true;
 }
Пример #5
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);
     }
   }
 }