Package org.bukkit

Examples of org.bukkit.Location.distance()


      } else {
        //Subtract whole block distances (switch to next guideline)
        while (true) {
          double tmpnext = Double.MAX_VALUE;
          if (guideindex < guide.length - 1) {
            tmpnext = prev.distance(guide[guideindex]);
          }
          if (tmpnext <= towalk) {
            towalk -= tmpnext;
            prev = guide[guideindex];
            guideindex++;
View Full Code Here


                        // If the user was previously within the range and moved, then execute
                        // the "Move" script.
                        //
                        boolean exitedProximity = hasExitedProximityOf(BukkitPlayer, npc);
                        double distance = 0;
                        if (!playerChangedWorlds) distance = npcLocation.distance(player.getLocation());

                        if (!exitedProximity
                                && (playerChangedWorlds || distance >= exitRadius)) {
                            if (!npc.getTriggerTrait().triggerCooldownOnly(trigger, player))
                                continue;
View Full Code Here

        ListIterator<CreeperExplosion> iter = explosionList.listIterator();
        while (iter.hasNext())
        {
            CreeperExplosion ex = iter.next();
            Location l = ex.getLocation();
            if (l.getWorld() == w && distanceNear > l.distance(loc))
            {
                ex.replace_blocks(false, CHBlockHealReason.FORCED);
                pass.add(ex);
                iter.remove();
            }
View Full Code Here

            for (int j = Math.max(0, loc.getBlockY() - radius); j < Math.min(w.getMaxHeight(), loc.getBlockY()
                                                                                               + radius); j++)
                for (int k = loc.getBlockZ() - radius; k < loc.getBlockZ() + radius; k++)
                {
                    Location l = new Location(w, i, j, k);
                    if (l.distance(loc) > radius)
                        continue;
                    Block b = l.getBlock();
                    if (isObsidianLike(b.getType(), table) && r.nextDouble() < chance)
                        record(b);
                }
View Full Code Here

     
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()+1, bl.getZ()).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()+1, bl.getZ()).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX()+1, plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX()+1, bl.getZ())-1, bl.getZ());
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());
           if(!ConflictPlugin.contaminated.contains(bl2) && l.distance(l2)<1.5*ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()-1, bl.getZ()).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()-1, bl.getZ()).getLocation());
View Full Code Here

        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()-1, bl.getZ()).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX()-1, bl.getZ()).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX()-1, plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX()-1, bl.getZ())-1, bl.getZ());
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());
           if(!ConflictPlugin.contaminated.contains(bl2) && l.distance(l2)<1.5* ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()+1).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()+1).getLocation());
View Full Code Here

        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()+1).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()+1).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX(), plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX(), bl.getZ()+1)-1, bl.getZ()+1);
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());          
           if(!ConflictPlugin.contaminated.contains(bl2&& l.distance(l2)< 1.5*ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()-1).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()-1).getLocation());
View Full Code Here

        
         if(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()-1).getTypeId()!=ConflictPlugin.VIRUSBLOCKID){
           //BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getHighestBlockAt(bl.getX(), bl.getZ()-1).getLocation());
           BlockLocation bl2 = new BlockLocation(plugin.getServer().getWorlds().get(0).getName(),  bl.getX(), plugin.getServer().getWorlds().get(0).getHighestBlockYAt(bl.getX(), bl.getZ()-1)-1, bl.getZ()-1);
           Location l = new Location(plugin.getServer().getWorlds().get(0), bl.getX(), bl.getY(), bl.getZ());
           if(!ConflictPlugin.contaminated.contains(bl2&& l.distance(l2)< 1.5*ConflictPlugin.virusDistance)
           ConflictPlugin.contaminated.add(bl2);  
         }
        
         //Block darunter
         if(bl.getY()>1){
View Full Code Here

    HashMap<String, Position> positions = getPortalLocations(middle.getWorld().getName());
    for (Map.Entry<String, Position> pos : positions.entrySet()) {
      Location ploc = Util.getLocation(pos.getValue());
      String portalname = pos.getKey();
      if (ploc != null && ploc.getWorld() == middle.getWorld()) {
        double distance = ploc.distance(middle);
        if (distance <= radius) {
          Portal newp = Portal.get(ploc);
          if (newp != null) {
            p = newp;
            radius = distance;
View Full Code Here

      if (sqd > bsqd) { bsqd = sqd; best = x; }
    }

    // return a location that is looking at the target
    Location dest = locationLookingAt(best, loc);
    return dest.distance(loc) < 1.0 ? null : dest;
  }

  public static Location blockTeleport(Block b)
  { return blockTeleport(b.getLocation()); }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.