Package org.bukkit.entity

Examples of org.bukkit.entity.Arrow


    // check if projectile
    if (cause == DamageCause.PROJECTILE){
      // check if arrow
      if (killer instanceof Arrow){
        Arrow arrow = (Arrow) killer;
        if (arrow.getShooter() instanceof Player){
          // player shot the arrow
          message = replacements(config.getString("deathShotByPlayer"), victim).replaceAll("%killer%", Nicknames.getNick(((Player) arrow.getShooter()).getName()));
        } else if (arrow.getShooter() instanceof Skeleton) {
          // skeleton shot the arrow
          message = replacements(config.getString("deathShotBySkeleton"), victim).replaceAll("%killer%", Utils.userFriendlyNames(arrow.getShooter().getType().getName()));
        } else {
          // something else shot the arrow, e.g. dispenser
          message = replacements(config.getString("deathShotByOther"), victim);
        }
      }
View Full Code Here


                    processTamingCombat(target, master, wolf, event);
                }
            }
        }
        else if (entityType == EntityType.ARROW) {
            Arrow arrow = (Arrow) damager;
            ProjectileSource projectileSource = arrow.getShooter();

            if (projectileSource != null && projectileSource instanceof Player && SkillType.ARCHERY.shouldProcess(target)) {
                Player player = (Player) projectileSource;

                if (!Misc.isNPCEntity(player) && SkillType.ARCHERY.getPermissions(player)) {
View Full Code Here

    public boolean doAction(Dispenser dis, ItemStack item, Vector velocity, BlockDispenseEvent event) {

        org.bukkit.material.Dispenser disp = (org.bukkit.material.Dispenser) dis.getData();
        BlockFace face = disp.getFacing();
        Location location = dis.getBlock().getRelative(face).getLocation().add(0.5, 0.5, 0.5);
        Arrow a = dis.getWorld().spawnArrow(location, velocity, 1.0f, 0.0f);
        a.setFireTicks(5000);
        return true;
    }
View Full Code Here

    public void shoot() {

        Player shooter = manned ? getShootingPlayer() : null;
        if(shooter != null) {
            Arrow ar = area.getWorld().spawnArrow(BlockUtil.getBlockCentre(area.getCenter() == null ? area.getCenter().getBlock() : getBackBlock()).add(0, 1, 0), shooter.getLocation().getDirection().normalize(), speed, 0);
            ar.setShooter(shooter);
            ar.setTicksLived(2500);
        } else {
            for (Entity ent : area.getEntitiesInArea()) {
                if(!(ent instanceof LivingEntity)) continue;
                boolean hasFound = false;
                for(EntityType type : types) {
                    if(type.is(ent)) {
                        hasFound = true;
                        break;
                    }
                }

                if (hasFound) {
                    double yOff = ((LivingEntity) ent).getEyeHeight();
                    Location k = LocationUtil.getCenterOfBlock(LocationUtil.getNextFreeSpace(getBackBlock(), BlockFace.UP));
                    Arrow ar = area.getWorld().spawnArrow(k, ent.getLocation().add(0, yOff, 0).subtract(k.clone().add(0.5,0.5,0.5)).toVector().normalize(), speed, 0);
                    if(!((LivingEntity)ent).hasLineOfSight(ar)) {
                        ar.remove();
                        continue;
                    }
                    break;
                }
            }
View Full Code Here

      if (null != damager && ed.getDamager() instanceof Arrow)
      {
        AutoRefPlayer apl = match.getPlayer(damager);
        if (apl != null) apl.incrementShotsHit();

        Arrow arrow = (Arrow) ed.getDamager();
        if (arrow.getShooter().getType() == EntityType.PLAYER)
        {
          AutoRefPlayer shooter = match.getPlayer((Player) arrow.getShooter());
          Location shotFrom = shotArrows.get(arrow);

          if (shooter != null && shotFrom != null)
            shooter.setFurthestShot(arrow.getLocation().distance(shotFrom));
        }
      }

      // spectators cannot cause damage to any entity
      if (match.getCurrentState().inProgress() &&
View Full Code Here

TOP

Related Classes of org.bukkit.entity.Arrow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.