Examples of distanceSquared()


Examples of org.bukkit.Location.distanceSquared()

        Iterator<Player> it = playerList.iterator();
        while (it.hasNext()) {
            Player player = it.next();
            Location loc = player.getLocation();
            if (loc.getWorld().equals(location.getWorld())
                    && loc.distanceSquared(location) < closestDistance) {
                closestPlayer = player;
                closestDistance = player.getLocation().distanceSquared(location);
            }
        }
        return closestPlayer;
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        Iterator<Player> it = playerList.iterator();
        while (it.hasNext()) {
            Player player = it.next();
            Location loc = player.getLocation();
            if (loc.getWorld().equals(location.getWorld())
                    && loc.distanceSquared(location) < closestDistance) {
                closestPlayers.add(dPlayer.mirrorBukkitPlayer(player));
            }
        }
        return closestPlayers;
    }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        Iterator<dNPC> it = DenizenAPI.getSpawnedNPCs().iterator();
        while (it.hasNext()) {
            dNPC npc = it.next();
            Location loc = npc.getLocation();
            if (loc.getWorld().equals(location.getWorld())
                    && loc.distanceSquared(location) < closestDistance) {
                closestNPC = npc;
                closestDistance = npc.getLocation().distanceSquared(location);
            }
        }
        return closestNPC;
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        while (it.hasNext()) {
            dNPC npc = it.next();
            Location loc = npc.getLocation();
            if (npc.getCitizen().hasTrait(TriggerTrait.class) && npc.getTriggerTrait().hasTrigger("CHAT") &&
                    loc.getWorld().equals(location.getWorld())
                    && loc.distanceSquared(location) < closestDistance) {
                closestNPC = npc;
                closestDistance = npc.getLocation().distanceSquared(location);
            }
        }
        return closestNPC;
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        // TODO: Why is this manually iterating?
        Iterator<dNPC> it = DenizenAPI.getSpawnedNPCs().iterator();
        while (it.hasNext ()) {
            dNPC npc = it.next ();
            Location loc = npc.getLocation();
            if (loc.getWorld().equals(location.getWorld()) && loc.distanceSquared(location) < maxRange) {
                closestNPCs.add(npc);
            }
        }
        return closestNPCs;
    }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

      // Recipient are not from same world
      if (!recipient.getWorld().equals(sender.getWorld())) {
        continue;
      }

      if (playerLocation.distanceSquared(recipient.getLocation()) > squaredDistance && !manager.has(sender, "chatmanager.override.ranged")) {
        continue;
      }

      recipients.add(recipient);
    }
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        if (!PartyManager.inSameParty(teleportingPlayer, targetPlayer)) {
            teleportingPlayer.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetPlayer.getName()));
            return;
        }

        if (newLocation.distanceSquared(previousLocation) > 1.0) {
            teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Cancelled"));
            return;
        }

        int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

            player.teleport(new Location(world, Math.floor(location.getX()) + 0.5D, world.getHighestBlockYAt((int) location.getX(), (int) location.getZ()), Math.floor(location.getZ()) + 0.5D));
            double value = Double.MAX_VALUE;

            for (int k = 0; k < locations.length; ++k) {
                if (location != locations[k]) {
                    double d = location.distanceSquared(locations[k]);
                    value = Math.min(d, value);
                }
            }

            distance += value;
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

            if (player == null || !player.isOnline()) {
                continue;
            }

            Location loc = player.getLocation();
            if (loc.distanceSquared(frozenState.getFreezeLocation()) >= MOVE_THRESHOLD_SQ) {
                loc.setX(frozenState.getFreezeLocation().getX());
                loc.setY(frozenState.getFreezeLocation().getY());
                loc.setZ(frozenState.getFreezeLocation().getZ());
                player.sendMessage(ChatColor.RED + "You are frozen.");
                player.teleport(loc);
View Full Code Here

Examples of org.bukkit.Location.distanceSquared()

        }

        // Skip locations which are essentially teleport jitter
        if (locationHistory.size() > 0) {
            Location lastLoc = locationHistory.peek().clone();
            if (lastLoc.getWorld().equals(location.getWorld()) && lastLoc.distanceSquared(location) <= 2) {
                return;
            }
        }

        locationHistory.add(0, location);
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.