Пример #1
0
 @EventHandler
 public void bowFire(EntityShootBowEvent event) {
   if (event.getEntityType().equals(EntityType.PLAYER)) {
     ((Player) event.getEntity())
         .getInventory()
         .setItemInHand(plugin.fixItem(((Player) event.getEntity()).getItemInHand()));
   }
 }
Пример #2
0
 @EventHandler
 public void onEntityDeath(EntityShootBowEvent e) {
   if (e.getEntity() instanceof Player) {
     Player p = (Player) e.getEntity();
     int game = GameManager.getInstance().getPlayerGameId(p);
     if (game != -1) {
       gm.getGame(game).getPlayerClass(p).PlayerShootArrow(e.getProjectile());
     }
   }
 }
Пример #3
0
 @EventHandler
 public void onEntityShootBow(EntityShootBowEvent event) {
   if (event.getEntity() instanceof Player && ((Player) event.getEntity()) == player) {
     if (step == 1) {
       long v = getAbsoluteLong();
       if (v != -1) {
         projectileTime = v;
       }
     }
   }
 }
Пример #4
0
 /**
  * Cancels firing a bow with a disabled weapon
  *
  * @param event event details
  */
 @EventHandler
 public void onShoot(EntityShootBowEvent event) {
   if (event.getEntity() instanceof Player) {
     if (InventoryTask.cannotUse(
         SkillAPI.getPlayerData((Player) event.getEntity()), event.getBow())) {
       SkillAPI.getLanguage()
           .sendMessage(ErrorNodes.CANNOT_USE, event.getEntity(), FilterType.COLOR);
       event.setCancelled(true);
     }
   }
 }
Пример #5
0
 @EventHandler
 public void onEntityShootBow(EntityShootBowEvent event) {
   if (!ScrimMatchHandler.isRunning()) {
     event.setCancelled(true);
     return;
   }
   if (event.getEntity() instanceof Player) {
     if (ScrimTeamHandler.isObserver((Player) event.getEntity())) {
       event.setCancelled(true);
     }
   }
 }
 @EventHandler(priority = EventPriority.MONITOR)
 public void onEntityShootBow(EntityShootBowEvent event) {
   if ((event.isCancelled())
       || (!(event.getEntity() instanceof Player))
       || (!(event.getProjectile() instanceof Arrow))) {
     return;
   }
   Hero hero =
       SkillExplodingArrow.this.plugin.getCharacterManager().getHero((Player) event.getEntity());
   if (hero.hasEffect("ExplodingArrowBuff")) {
     int mana = SkillConfigManager.getUseSetting(hero, this.skill, "mana-per-shot", 1, true);
     if (hero.getMana() < mana) hero.removeEffect(hero.getEffect("ExplodingArrowBuff"));
     else hero.setMana(hero.getMana() - mana);
   }
 }
Пример #7
0
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onEntityShootBowEvent(EntityShootBowEvent event) {
   if (event.isCancelled()) {
     return;
   }
   if (!(event.getEntity() instanceof Player)) {
     return;
   }
   Player p = (Player) event.getEntity();
   ItemStack iimh = p.getEquipment().getItemInMainHand();
   Tier t = iimh != null ? TierUtil.getTierFromItemStack(iimh) : null;
   if (t != null && t.isInfiniteDurability()) {
     iimh.setDurability((short) 0);
   }
 }
Пример #8
0
  @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
  public void EntityShootBowEvent(EntityShootBowEvent e) {

    Entity shooter = e.getEntity();

    if (shooter instanceof Player) CEventHandler.handleEvent((Player) shooter, e, shootBow);
  }
Пример #9
0
  @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
  private void onEntityShootBow(EntityShootBowEvent event) {
    Entity entity = event.getEntity();

    if (entity instanceof Player) {
      DurabilityUtils.handleInfiniteDurability(((Player) entity).getItemInHand());
    }
  }
Пример #10
0
  @EventHandler(priority = EventPriority.HIGHEST)
  private void onShootBow(EntityShootBowEvent evt) {
    if (!(evt.getEntity() instanceof Player)) {
      return;
    }

    Player player = (Player) evt.getEntity();
    PlayerDataClass playerData = plugin.getPlayerHandler().findPlayer(player.getDisplayName());

    if (playerData != null) {
      if (playerData.getType().equals("sniper")
          && evt.getForce() == 1
          && playerData.isScoped() == true) {
        evt.getProjectile().setMetadata("charged", new FixedMetadataValue(plugin, true));
      }
    }
  }
Пример #11
0
  @EventHandler(priority = EventPriority.MONITOR)
  public void onBowShoot(EntityShootBowEvent event) {

    if (event.isCancelled() == false && !worlds.contains(event.getEntity().getWorld().getName())) {
      if (event.getEntity() instanceof Player) {
        Player p = (Player) event.getEntity();

        // total shots fired
        playerStatManager.getPlayerBlob(p.getName()).getStat("bow", "shots").incrementStat(1);

        if (event.getBow().containsEnchantment(Enchantment.ARROW_FIRE)) {
          playerStatManager.getPlayerBlob(p.getName()).getStat("bow", "fireshots").incrementStat(1);
        }

        if (event.getBow().containsEnchantment(Enchantment.ARROW_INFINITE)) {
          playerStatManager
              .getPlayerBlob(p.getName())
              .getStat("bow", "infiniteshots")
              .incrementStat(1);
        }
      }
    }
  }
Пример #12
0
 @EventHandler
 public void onBowUse(EntityShootBowEvent e) {
   if (!(e.getEntity() instanceof Player) || !(e.getProjectile() instanceof Arrow)) return;
   if (SlimefunItem.getByItem(e.getBow()) != null)
     Variables.arrows.put(e.getProjectile().getUniqueId(), e.getBow());
 }
Пример #13
0
 @EventHandler
 public void onBowShoot(final EntityShootBowEvent e) {
   if (!Api.allowsPVP(e.getEntity())) return;
   if (e.getBow().hasItemMeta()) {
     if (e.getBow().getItemMeta().hasLore()) {
       for (String lore : e.getBow().getItemMeta().getLore()) {
         if (lore.contains(Api.getEnchName("Boom"))) {
           if (Api.isEnchantmentEnabled("Boom")) {
             Arrow.put(
                 (Projectile) e.getProjectile(), Api.getPower(lore, Api.getEnchName("Boom")));
             P.put((Projectile) e.getProjectile(), e.getEntity());
             Enchant.put((Projectile) e.getProjectile(), "Boom");
           }
         }
         if (lore.contains(Api.getEnchName("Doctor"))) {
           if (Api.isEnchantmentEnabled("Doctor")) {
             Arrow.put(
                 (Projectile) e.getProjectile(), Api.getPower(lore, Api.getEnchName("Doctor")));
             P.put((Projectile) e.getProjectile(), e.getEntity());
             Enchant.put((Projectile) e.getProjectile(), "Doctor");
           }
         }
         if (lore.contains(Api.getEnchName("IceFreeze"))) {
           if (Api.isEnchantmentEnabled("IceFreeze")) {
             Arrow.put(
                 (Projectile) e.getProjectile(), Api.getPower(lore, Api.getEnchName("IceFreeze")));
             P.put((Projectile) e.getProjectile(), e.getEntity());
             Enchant.put((Projectile) e.getProjectile(), "IceFreeze");
           }
         }
         if (lore.contains(Api.getEnchName("Lightning"))) {
           if (Api.isEnchantmentEnabled("Lightning")) {
             Arrow.put(
                 (Projectile) e.getProjectile(), Api.getPower(lore, Api.getEnchName("Lightning")));
             P.put((Projectile) e.getProjectile(), e.getEntity());
             Enchant.put((Projectile) e.getProjectile(), "Lightning");
           }
         }
         if (lore.contains(Api.getEnchName("Piercing"))) {
           if (Api.isEnchantmentEnabled("Piercing")) {
             Arrow.put(
                 (Projectile) e.getProjectile(), Api.getPower(lore, Api.getEnchName("Piercing")));
             P.put((Projectile) e.getProjectile(), e.getEntity());
             Enchant.put((Projectile) e.getProjectile(), "Piercing");
           }
         }
         if (lore.contains(Api.getEnchName("Venom"))) {
           if (Api.isEnchantmentEnabled("Venom")) {
             Arrow.put(
                 (Projectile) e.getProjectile(), Api.getPower(lore, Api.getEnchName("Venom")));
             P.put((Projectile) e.getProjectile(), e.getEntity());
             Enchant.put((Projectile) e.getProjectile(), "Venom");
           }
         }
         if (lore.contains(Api.getEnchName("MultiArrow"))) {
           if (Api.isEnchantmentEnabled("MultiArrow")) {
             int power = Api.getPower(lore, Api.getEnchName("MultiArrow"));
             if (Api.randomPicker(2)) {
               for (int i = 1; i <= power; i++) {
                 Arrow arrow =
                     e.getEntity().getWorld().spawn(e.getProjectile().getLocation(), Arrow.class);
                 arrow.setShooter(e.getEntity());
                 arrow.setBounce(false);
                 Vector v = new Vector(Vec(), 0, Vec());
                 arrow.setVelocity(e.getProjectile().getVelocity().add(v));
                 if (((Arrow) e.getProjectile()).isCritical()) arrow.setCritical(true);
               }
             }
           }
         }
       }
     }
   }
 }