Skip to content

Commit

Permalink
optimize distance checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeebiss committed Apr 3, 2013
1 parent b0bd98e commit 1ad6a60
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -2,6 +2,7 @@

import java.util.List;

import net.aufdemrand.denizen.utilities.Utilities;
import net.aufdemrand.denizen.utilities.arguments.dLocation;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -165,12 +166,14 @@ public void walking(PlayerMoveEvent event) {
}
} else if (type == TravelType.TOLOCATION) {
if (!player.getLocation().getWorld().equals(endPoint.getWorld())) return;
if (player.getLocation().distance(endPoint) <= radius) {
//if (player.getLocation().distance(endPoint) <= radius) {
if (Utilities.checkLocation(player, endPoint, radius)) {
dB.echoDebug("...player reached location");
finish();
}
} else if (type == TravelType.TONPC) {
if (player.getLocation().distance(target.getBukkitEntity().getLocation()) <= radius) {
//if (player.getLocation().distance(target.getBukkitEntity().getLocation()) <= radius) {
if (Utilities.checkLocation(player, target.getBukkitEntity().getLocation(), radius)) {
dB.echoDebug("...player reached NPC");
finish();
}
Expand Down

0 comments on commit 1ad6a60

Please sign in to comment.