Java 类org.bukkit.event.entity.EntityShootBowEvent 实例源码

项目:libtrails    文件:BasicExample.java   
@EventHandler
public void onBowShot(EntityShootBowEvent e) {
    if (e.getEntity() instanceof Player &&
            e.getProjectile() instanceof Arrow) {
        Bukkit.getScheduler().runTaskLater(this, () -> {
            if (!e.getProjectile().isDead()) {
                EntityTrail t = new EntityTrail(this, e.getProjectile(),
                        new ScatteringSupplier(particles,
                                new Vector3(2.0f, 1.0f, 2.0f),
                                Vector3.ORIGIN, 5, 20, 1)
                        , 1);

                trails.put(e.getProjectile(), t);
                t.begin();
            }
        }, 5L);
    }
}
项目:libtrails    文件:ColorfulExample.java   
@EventHandler
public void onBowShot(EntityShootBowEvent e) {
    if (e.getEntity() instanceof Player &&
            e.getProjectile() instanceof Arrow) {
        Bukkit.getScheduler().runTaskLater(this, () -> {
            if (!e.getProjectile().isDead()) {
                EntityTrail t = new EntityTrail(this, e.getProjectile(),
                        new CircumferenceSupplier(particle, 1.2f, 0.9f, 0.0f, 1)
                        .rotateY(tick -> tick * (2.0f * (float) Math.PI / 20))
                        , 1);
                trails.put(e.getProjectile(), t);
                t.begin();
            }
        }, 5L);
    }
}
项目:BiteSkywars    文件:PlayerListener.java   
@EventHandler
public void onShotArrow(EntityShootBowEvent event)
{

 if(event.getEntity() instanceof Player){
     Player p = (Player)event.getEntity();
     if(event.getProjectile() instanceof Arrow){
         Arena a = am.getArena(p);
         if(a!=null){
             if(a.isGame()){
                 SPlayer player = SPlayer.getDPlayer(p);
                 player.addShots(1);
             }
         }
     }
 }

}
项目:Breakpoint    文件:PVPListener.java   
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event)
{
    LivingEntity eShooter = event.getEntity();

    if(!(eShooter instanceof Player))
        return;

    Player shooter = (Player) eShooter;
    BPPlayer bpShooter = BPPlayer.get(shooter);
    Game game = bpShooter.getGame();

    if(game == null)
        return;

    game.getListener().onPlayerShootBow(event, bpShooter);
}
项目:Statz    文件:ArrowsShotListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onShootArrow(final EntityShootBowEvent event) {

    final PlayerStat stat = PlayerStat.ARROWS_SHOT;

    if (!(event.getEntity() instanceof Player)) {
        return; // It was not a player that shoot a bow
    }

    // Get player
    final Player player = (Player) event.getEntity();

    // Do general check
    if (!plugin.doGeneralCheck(player, stat))
        return;

    // Update value to new stat.
    plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid",
            player.getUniqueId(), "value", 1, "world", player.getWorld().getName(), "forceShot", event.getForce()));

}
项目:EnderBow    文件:EnderBowListener.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityShootBowEvent(EntityShootBowEvent event) {
    if ((event.getBow().hasItemMeta() && event.getBow().getItemMeta().getDisplayName().equals("Ender bow")) || event
            .getBow() instanceof EnderBowPlugin.EnderBow) {
        // Create custom event
        EntityShootEnderBowEvent entityShootEnderBowEvent = new EntityShootEnderBowEvent(event);

        // Call the custom event
        EnderBowPlugin.getInstance().getServer().getPluginManager().callEvent(entityShootEnderBowEvent);

        // Do the following, if it wasn't cancelled
        if (!entityShootEnderBowEvent.isCancelled()) {
            // Fire an ender pearl
            event.getEntity().launchProjectile(EnderPearl.class).setVelocity(event.getProjectile().getVelocity());

            // Play the 'ENDERMAN_TELEPORT' sound
            event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1);
        }

        // Cancel the original Event, so no arrows are fired
        event.setCancelled(true);
    }
}
项目:BiteSkywars    文件:PlayerListener.java   
@EventHandler
public void onShotArrow(EntityShootBowEvent event)
{

 if(event.getEntity() instanceof Player){
     Player p = (Player)event.getEntity();
     if(event.getProjectile() instanceof Arrow){
         Arena a = am.getArena(p);
         if(a!=null){
             if(a.isGame()){
                 SPlayer player = SPlayer.getDPlayer(p);
                 player.addShots(1);
             }
         }
     }
 }

}
项目:RedProtect    文件:RPMine19.java   
@EventHandler
public void onShootBow(EntityShootBowEvent e){
    if (e.isCancelled() || !(e.getEntity() instanceof Player)){
        return;
    }

    Player p = (Player) e.getEntity();      
    Entity proj = e.getProjectile();
    List<String> Pots = RPConfig.getStringList("server-protection.deny-potions");

    if (proj != null && (proj instanceof TippedArrow)){
        TippedArrow arr = (TippedArrow) proj;
        if (Pots.contains(arr.getBasePotionData().getType().name())){
            RPLang.sendMessage(p, "playerlistener.denypotion");
            e.setCancelled(true);
        }
    }
}
项目:Breakpoint    文件:PVPListener.java   
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event)
{
    LivingEntity eShooter = event.getEntity();

    if(!(eShooter instanceof Player))
        return;

    Player shooter = (Player) eShooter;
    BPPlayer bpShooter = BPPlayer.get(shooter);
    Game game = bpShooter.getGame();

    if(game == null)
        return;

    game.getListener().onPlayerShootBow(event, bpShooter);
}
项目:IZenith-Main    文件:BowListener.java   
@SuppressWarnings("deprecation")
@EventHandler
public void onArrowFire(EntityShootBowEvent e) {
    if (e.getEntityType().equals(EntityType.PLAYER) && e.getBow().hasItemMeta()) {
        ItemMeta meta = e.getBow().getItemMeta();
        if (meta.hasDisplayName() && Util.containsIgnoreCase(meta.getDisplayName(), "dick") && e.getEntity().hasPermission("bow.dick")) {
            arrows.add(e.getProjectile());
            String name = meta.getDisplayName();
            if (name.contains(":")) {
                String[] splitName = name.split(":");
                if (splitName[0].equalsIgnoreCase("dick")) {
                    splitName[1] = splitName[1].replace(" ", "");
                    try {
                        int id = Integer.parseInt(splitName[1]);
                        arrowMaterials.put(e.getProjectile(), Material.getMaterial(id));
                    } catch (NumberFormatException exc) {
                    }
                }
            }
        }
    }
}
项目:StarQuestCode    文件:SQSkywatch.java   
@EventHandler
public void onSkeletonShoot(EntityShootBowEvent event){
    if(event.getEntity() instanceof Skeleton){
        Skeleton s = (Skeleton) event.getEntity();
        if(DroneShocktroop.isPossiblyShocktroop(s)){
            DroneShocktroop troop = getShocktroop(s);
            if(troop == null){
                s.remove();
                //System.out.println("troop for named skeleton is null, removing!");
                event.setCancelled(true);
            } else {
                //System.out.println("Allowed fire!");
            }
        }
    }
}
项目:DDCustomPlugin    文件:FairFly.java   
@SuppressWarnings("deprecation")
public void onShoot(EntityShootBowEvent event)
{
    if ((event.getEntity() instanceof Player)) {
        Player archer = (Player)event.getEntity();
        if (archer.getAllowFlight()) {
            if ((archer.isFlying()) && (!archer.hasPermission("Fly.damage")) && 
                    (archer.getGameMode() != GameMode.CREATIVE)) {
                event.setCancelled(true);
                archer.updateInventory();
            }
            if (!archer.isFlying() && archer.getGameMode() != GameMode.CREATIVE) {
                archer.setFlying(false);
                archer.setAllowFlight(false);
                archer.sendMessage(ChatColor.GOLD + "You were put out of fly mode.");
            }
        }
    }
}
项目:McMMOPlus    文件:EntityListener.java   
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityShootBow(EntityShootBowEvent event) {
    Entity projectile = event.getProjectile();

    if (!(projectile instanceof Arrow)) {
        return;
    }

    ItemStack bow = event.getBow();

    if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
        projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
    }

    projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
    projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
}
项目:TCMinigames    文件:PlayerListener.java   
@EventHandler
public void onArrowShoot(EntityShootBowEvent event){
    if(Minigame.getCurrentMinigame()!=null){
        switch(Minigame.getCurrentMinigame().getMap().getType()){
        case CIRCLE_OF_BOOM:
            if(Team.getTeam((Player)event.getEntity()).equals(Minigame.getObservers())){
                event.setCancelled(true);
            }
            break;
        case KEY_QUEST:
            break;
        case WATER_THE_MONUMENT:
            break;
        default:
            break;
        }
    }
}
项目:Wayward    文件:EntityShootBowListener.java   
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event) {
    if (event.getEntity() instanceof Player) {
        if (plugin.getMaterial("Harp").isMaterial(event.getBow())) {
            event.setCancelled(true);
            for (Player player : event.getEntity().getWorld().getPlayers()) {
                if (player.getLocation().distanceSquared(event.getEntity().getLocation()) <= 64) {
                    try {
                        File musicDirectory = new File(plugin.getDataFolder(), "music");
                        plugin.getJingleNoteManager().play(plugin, player.getName(), new MidiJingleSequencer(new File(musicDirectory, "canon.mid"), false));
                    } catch (MidiUnavailableException | InvalidMidiDataException | IOException exception) {
                        exception.printStackTrace();
                    }
                }
            }
        }
    }
}
项目:Headshot    文件:EntityListener.java   
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityShootBow (EntityShootBowEvent event)
  {
    if ( ! (event.getEntity() instanceof Player))
      return;
    if (plugin.getConfig().getBoolean("general.particle-trail")
        && event.getProjectile() instanceof Arrow)
      {
        plugin.addArrow((Arrow) event.getProjectile());
        plugin.updateEffectMaker();
      }
    Player player = (Player) event.getEntity();
    if ( !player.hasPermission("headshot.bypass.reload-time"))
      {
        long cooldown =
            plugin.getConfig().getLong("general.reload-time", 0) * 50;
        if (cooldown == 0)
          return;
        plugin.setCooldown(player, System.currentTimeMillis() + cooldown);
      }
  }
项目:Demigods3    文件:BowOfTria.java   
@EventHandler(priority = EventPriority.HIGH)
private void onEntityShootBow(EntityShootBowEvent event) {
    // Return for disabled world
    if (Zones.inNoDemigodsZone(event.getEntity().getLocation())) return;

    // If they right clicked a block with the ITEM in hand, do stuff
    if (Items.areEqual(event.getBow(), ITEM)) {
        PlayerInventory inventory = null;
        Arrow startArrow = (Arrow) event.getProjectile();
        startArrow.setVelocity(startArrow.getVelocity().multiply(.8));

        if (event.getEntity() instanceof Player) inventory = ((Player) event.getEntity()).getInventory();

        for (int i = 1; i < 3; i++) {
            if (inventory != null) {
                if (!inventory.contains(Material.ARROW, 1)) break;
                inventory.remove(new ItemStack(Material.ARROW, 1));
            }

            Arrow spawnedArrow = (Arrow) event.getEntity().getWorld().spawnEntity(startArrow.getLocation(), EntityType.ARROW);
            spawnedArrow.setShooter(event.getEntity());
            spawnedArrow.setVelocity(startArrow.getVelocity().multiply(.9 / i));
        }
    }
}
项目:ServerUtils    文件:FestiveArrows.java   
@EventHandler
public void onBowShoot(EntityShootBowEvent event) {
    FireworkMeta fireworkMeta = (FireworkMeta) (new ItemStack(
            Material.FIREWORK)).getItemMeta();
    Firework firework = (Firework) event
            .getProjectile()
            .getLocation()
            .getWorld()
            .spawnEntity(event.getProjectile().getLocation(),
                    EntityType.FIREWORK);

    fireworkMeta.addEffect(FireworkEffect.builder().with(Type.BURST)
            .withColor(Color.RED).withColor(Color.WHITE)
            .withColor(Color.BLUE).withTrail().build());
    firework.setFireworkMeta(fireworkMeta);
    event.getProjectile().setPassenger(firework);
}
项目:Crescent    文件:FastbowA.java   
@Override
public void call(Event event) {
    if (event instanceof EntityShootBowEvent) {
        if (lastTime != -1) {
            if (System.currentTimeMillis() - lastTime < ALLOWED_MINIMUM_DIFFERENCE) {
                callback(true);
            }
        }

        lastTime = System.currentTimeMillis();
    }
}
项目:Crescent    文件:DetectionListener.java   
@EventHandler
public void onPlayerInteract(EntityShootBowEvent event) {
    if (!(event.getEntity() instanceof Player)) {
        return;
    }

    final Player player = (Player) event.getEntity();

    getCheckVersion(player, CheckType.FASTBOW, "A").call(event);
}
项目:SurvivalPlus    文件:Bow.java   
@SuppressWarnings("deprecation")
@EventHandler
public void onShootWithoutArrows(EntityShootBowEvent event)
{
    if(event.getEntity() instanceof Player)
    {
        Player player = (Player)event.getEntity();
        if(player.getInventory().getItemInMainHand().getType() == event.getBow().getType())
        {
            if
            (
                player.getInventory().getItemInOffHand().getType() == Material.ARROW
                || player.getInventory().getItemInOffHand().getType() == Material.SPECTRAL_ARROW
                || player.getInventory().getItemInOffHand().getType() == Material.TIPPED_ARROW
            )
            {
                event.setCancelled(false);
            }
            else
            {
                event.setCancelled(true);
                player.sendMessage(ChatColor.RED + Survival.Words.get("Must load Arrows on off hand"));
                player.updateInventory();
            }
        }
        else
        {
            event.setCancelled(true);
            player.sendMessage(ChatColor.RED + Survival.Words.get("Must use a Bow with main hand"));
            player.updateInventory();
        }
    }
}
项目:DynamicAC    文件:DamageListener.java   
@EventHandler
@SuppressWarnings("unused")
public void onBowShoot(EntityShootBowEvent e) {
    if(e.getEntity() instanceof Player) {
        Player player = (Player) e.getEntity();
        DynamicAC.getManager().getBackend().checkFastBow(player, e.getForce());
    }
}
项目:NationZ    文件:EnchantmentZ_Infinity.java   
@EventHandler
public void onShoot(EntityShootBowEvent e) {
    if (e.getEntity() instanceof Player) {
        Item es  = Item.get(e.getBow());
        if (es.hasEnchantment(INFINITY)) {
            Player p = (Player) e;
            int r = (int) Math.random() * 100;
            switch (es.getEnchantmentLevel(UNBREAKING)) {
                case 1:
                    if (r <= 20) {
                        p.getInventory().addItem(new ItemStack(Material.ARROW));
                    }
                    break;
                case 2:
                    if (r <= 40) {
                        p.getInventory().addItem(new ItemStack(Material.ARROW));
                    }
                    break;
                case 3:
                    if (r <= 60) {
                        p.getInventory().addItem(new ItemStack(Material.ARROW));
                    }
                    break;
                case 4:
                    if (r <= 80) {
                        p.getInventory().addItem(new ItemStack(Material.ARROW));
                    }
                    break;
                case 5:
                    break;
            }
        }
    }
}
项目:BiteSkywars    文件:TripleArrow.java   
@EventHandler
      public void onShoot(EntityShootBowEvent e)
      {
        if ((e.getEntity() instanceof Player))
        {
          Player p = (Player)e.getEntity();


if(Habilidad.getPercentAbility(p, HabilidadType.TRIPLE_ARROW)==0){
    return;
}
            if (new Random().nextInt(100)+1 <= Habilidad.getPercentAbility(p, HabilidadType.TRIPLE_ARROW))
            {
              Arrow a1 = (Arrow)p.launchProjectile(Arrow.class);
              Arrow a2 = (Arrow)p.launchProjectile(Arrow.class);
              if ((getDirection(Float.valueOf(p.getLocation().getYaw())) == "EAST") || (getDirection(Float.valueOf(p.getLocation().getYaw())) == "WEST"))
              {
                a1.setVelocity(new Vector(a1.getVelocity().getX(), a1.getVelocity().getY(), a1.getVelocity().getZ() - 0.1D));
                a2.setVelocity(new Vector(a2.getVelocity().getX(), a2.getVelocity().getY(), a2.getVelocity().getZ() + 0.1D));
              }
              else
              {
                a1.setVelocity(new Vector(a1.getVelocity().getX() - 0.1D, a1.getVelocity().getY(), a1.getVelocity().getZ()));
                a2.setVelocity(new Vector(a2.getVelocity().getX() + 0.1D, a2.getVelocity().getY(), a2.getVelocity().getZ()));
              }
            }

        }
      }
项目:BiteSkywars    文件:ArrowController.java   
@EventHandler
public void trail(EntityShootBowEvent paramEntityShootBowEvent)
{
  LivingEntity localLivingEntity = paramEntityShootBowEvent.getEntity();
  Entity localEntity = paramEntityShootBowEvent.getProjectile();
  if ((localEntity instanceof Projectile))
  {
    final Projectile localProjectile = (Projectile)localEntity;
    if (((localProjectile instanceof Arrow)) && ((localLivingEntity instanceof Player)))
    {


      Player localPlayer = (Player)localLivingEntity;
      Arena a = new ArenaManager().getArena(localPlayer);
      if(a==null){
          return;
      }
 if(!retornar(localPlayer)){
     return;
 }
          ParticleEffect localParticleEffect = effect(localPlayer);
         final float f1 = 0.3F;
         final float f2 = 0.3F;
         final  float f3 = 0.3F;
         final  float f4 = 0.3F;
         final  int i = 20;
         final double d = 20.0D;

         ArrowTrailSender(f1, f2, f3, f4, i, i, localParticleEffect, localProjectile, d);
    }
  }


}
项目:AthenaGM    文件:PlayerFreezeModule.java   
/**
 * Stop frozen players from firing bows
 */
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event) {
    if (event.getEntity() instanceof Player) {
        Player player = (Player) event.getEntity();
        if (shouldFreeze(player)) {
            event.setCancelled(true);
        }
    }
}
项目:Damocles    文件:ArrowHandler.java   
@EventHandler
public void onArrowShoot(EntityShootBowEvent event){
    if(event.getEntity() instanceof Player){
        Player player = (Player) event.getEntity();
        Effect item;
        if(arrows.containsKey(player.getUniqueId())){
            item = arrows.get(player.getUniqueId());
            shot.put(player.getUniqueId(), item);
            arrows.remove(player.getUniqueId());
            return;
        }
        return;
    }
}
项目:Lore-Attributes-Reloaded    文件:LoreEvents.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void checkBowRestriction(EntityShootBowEvent event) {
    if (!(event.getEntity() instanceof Player)) {
        return;
    }
    if (!LoreAttributes.loreManager.canUse((Player) event.getEntity(), event.getBow()))
        event.setCancelled(true);
}
项目:CubeKrowd-Icerunner    文件:Game.java   
@EventHandler
public void onEntityShootBow (EntityShootBowEvent event) { 
    if (event.getEntity() instanceof Player && event.getProjectile() instanceof Arrow) { 
        if(hitPlayers.containsKey(event.getEntity())){
            hitPlayers.put((Player) event.getEntity(), hitPlayers.get(event.getEntity()) + 1);
        }
        else{
            hitPlayers.put((Player) event.getEntity(), 1);
        }
        ((Player) event.getEntity()).getInventory().getItemInMainHand().setDurability((short) -1);
    }
}
项目:Skellett    文件:ExprShootGetArrow.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityShootBowEvent.class)) {
        Skript.error("You can not use Get Arrow expression in any event but 'on entity shoot:' event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprShootArrowSpeed.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityShootBowEvent.class)) {
        Skript.error("You can not use Arrow speed expression in any event but 'on entity shoot:' event!");
        return false;
    }
    return true;
}
项目:Skellett    文件:ExprShootGetBow.java   
public boolean init(Expression<?>[] args, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
    if (!ScriptLoader.isCurrentEvent(EntityShootBowEvent.class)) {
        Skript.error("You can not use Get Bow expression in any event but 'on entity shoot:' event!");
        return false;
    }
    return true;
}
项目:OmniWorldMCPlugin    文件:EnderBowListener.java   
@EventHandler
public void onShootBow(EntityShootBowEvent event) {
    if ((event.getEntity() instanceof Player)) {
        Player player = (Player) event.getEntity();
        if ((event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 2) || (event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 3)) {
            if (player.hasPermission(PermLib.USE_ENDERBOW)) {
                if (player.getInventory().contains(Material.ENDER_PEARL)) {
                    if (event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 2) {
                        event.setCancelled(true);
                        player.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ENDER_PEARL, 1)});
                        ((EnderPearl) player.launchProjectile(EnderPearl.class)).setVelocity(event.getProjectile().getVelocity().multiply(1.1D));
                        player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1.0F, 1.0F);
                    } else if (event.getBow().getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 3) {
                        event.setCancelled(true);
                        ((EnderPearl) player.launchProjectile(EnderPearl.class)).setVelocity(event.getProjectile().getVelocity().multiply(1.1D));
                        player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1.0F, 1.0F);
                        event.getBow().setDurability((short) 384);
                    }
                } else {
                    event.setCancelled(true);
                }
            } else {
                player.sendMessage(ChatLib.NO_PERMS_ENDERBOW);
            }
        } else {}
    }
}
项目:Cardinal-Plus    文件:Projectiles.java   
@EventHandler
public void onEntityShootBowEvent(EntityShootBowEvent event) {
    if (!projectile.equals(EntityType.ARROW) || velocityMod != 1.0) {
        Vector vector = event.getProjectile().getVelocity();
        event.setProjectile(GameHandler.getGameHandler().getMatchWorld().spawnEntity(event.getProjectile().getLocation(), projectile));
        ((Projectile) event.getProjectile()).setShooter(event.getEntity());
        event.getProjectile().setVelocity(vector.multiply(velocityMod));
        event.getProjectile().setMetadata("custom", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), true));
    }
}
项目:BiteSkywars    文件:TripleArrow.java   
@EventHandler
      public void onShoot(EntityShootBowEvent e)
      {
        if ((e.getEntity() instanceof Player))
        {
          Player p = (Player)e.getEntity();


if(Habilidad.getPercentAbility(p, HabilidadType.TRIPLE_ARROW)==0){
    return;
}
            if (new Random().nextInt(100)+1 <= Habilidad.getPercentAbility(p, HabilidadType.TRIPLE_ARROW))
            {
              Arrow a1 = (Arrow)p.launchProjectile(Arrow.class);
              Arrow a2 = (Arrow)p.launchProjectile(Arrow.class);
              if ((getDirection(Float.valueOf(p.getLocation().getYaw())) == "EAST") || (getDirection(Float.valueOf(p.getLocation().getYaw())) == "WEST"))
              {
                a1.setVelocity(new Vector(a1.getVelocity().getX(), a1.getVelocity().getY(), a1.getVelocity().getZ() - 0.1D));
                a2.setVelocity(new Vector(a2.getVelocity().getX(), a2.getVelocity().getY(), a2.getVelocity().getZ() + 0.1D));
              }
              else
              {
                a1.setVelocity(new Vector(a1.getVelocity().getX() - 0.1D, a1.getVelocity().getY(), a1.getVelocity().getZ()));
                a2.setVelocity(new Vector(a2.getVelocity().getX() + 0.1D, a2.getVelocity().getY(), a2.getVelocity().getZ()));
              }
            }

        }
      }
项目:BiteSkywars    文件:ArrowController.java   
@EventHandler
public void trail(EntityShootBowEvent paramEntityShootBowEvent)
{
  LivingEntity localLivingEntity = paramEntityShootBowEvent.getEntity();
  Entity localEntity = paramEntityShootBowEvent.getProjectile();
  if ((localEntity instanceof Projectile))
  {
    final Projectile localProjectile = (Projectile)localEntity;
    if (((localProjectile instanceof Arrow)) && ((localLivingEntity instanceof Player)))
    {


      Player localPlayer = (Player)localLivingEntity;
      Arena a = new ArenaManager().getArena(localPlayer);
      if(a==null){
          return;
      }
 if(!retornar(localPlayer)){
     return;
 }
          ParticleEffect localParticleEffect = effect(localPlayer);
         final float f1 = 0.3F;
         final float f2 = 0.3F;
         final  float f3 = 0.3F;
         final  float f4 = 0.3F;
         final  int i = 20;
         final double d = 20.0D;

         ArrowTrailSender(f1, f2, f3, f4, i, i, localParticleEffect, localProjectile, d);
    }
  }


}
项目:UberHardcore    文件:CustomSkeleton.java   
public void a(EntityLiving entityliving, float f) {
//        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
        int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bz());
        int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bz());
        entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
        if(i > 0) {
            entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
        }

        if(j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || this.getSkeletonType() == 1) {
            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if(!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

        EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bz(), entityarrow, 0.8F);
        if(event1.isCancelled()) {
            event1.getProjectile().remove();
        } else {
            if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
                this.world.addEntity(entityarrow);
            }

            this.makeSound("random.bow", 1.0F, 1.0F / (this.bb().nextFloat() * 0.4F + 0.8F));
        }
    }
项目:UberHardcore    文件:CustomSkeleton.java   
public void a(EntityLiving entityliving, float f) {
//        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
        int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA());
        int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA());
        entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
        if(i > 0) {
            entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
        }

        if(j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if(!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

        EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F);
        if(event1.isCancelled()) {
            event1.getProjectile().remove();
        } else {
            if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
                this.world.addEntity(entityarrow);
            }

            this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F));
        }
    }
项目:UberHardcore    文件:CustomSkeleton.java   
public void a(EntityLiving entityliving, float f) {
//        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
        EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
        int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA());
        int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA());
        entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
        if(i > 0) {
            entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
        }

        if(j > 0) {
            entityarrow.setKnockbackStrength(j);
        }

        if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
            EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
            this.world.getServer().getPluginManager().callEvent(event);
            if(!event.isCancelled()) {
                entityarrow.setOnFire(event.getDuration());
            }
        }

        EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F);
        if(event1.isCancelled()) {
            event1.getProjectile().remove();
        } else {
            if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
                this.world.addEntity(entityarrow);
            }

            this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F));
        }
    }
项目:LoreAttributes-reloaded    文件:LoreEvents.java   
@EventHandler(priority = EventPriority.HIGHEST)
public void checkBowRestriction(EntityShootBowEvent event) {
    if (!(event.getEntity() instanceof Player)) {
        return;
    }
    if (!LoreAttributes.loreManager.canUse((Player) event.getEntity(), event.getBow()))
        event.setCancelled(true);
}